[Pkg-ltsp-devel] Bug#462760: ldm: autologin (using LDM_USERNAME or LDM_PASSWORD in lts.conf) does not work

SZABO Zsolt szazs at mm.bme.hu
Sun Jan 27 11:16:40 UTC 2008


Package: ldm
Version: 0.1~bzr20071217
Severity: normal
Tags: patch


I think that get_host(), get_language(), get_session() and maybe
close_greeter() function called from ldm.c should be fixed for the case of
automated login (defining LDM_USERNAME or LDM_PASSWORD in lts.conf).
Or one has to define LDM_SERVER, LDM_LANGUAGE and LDM_SESSION, as well.

The patch below give a rough (not thoroghly tested) solution:

--- ldm-0.1~bzr20071217/src/ldm.c	2007-12-18 01:36:17.000000000 +0100
+++ ldm-0.1~bzr20071217.new/src/ldm.c	2008-01-26 02:13:00.000000000 +0100
@@ -482,22 +482,25 @@
             close(ldminfo.sshfd);
         }
     }
+    fprintf(ldmlog, "Established ssh session.\n");
 
     /*
      * Clear out the password so it's not sitting in memory anywhere
      */
 
     bzero(ldminfo.password, sizeof ldminfo.password);
+    fprintf(ldmlog, "Password cleared.\n");
 
+  if (!ldminfo.autologin) {
     if (get_language())
         die("Couldn't get a valid language setting");
     if (get_session())
         die("Couldn't get a valid session setting");
 
 
-    fprintf(ldmlog, "Established ssh session.\n");
     if (ldminfo.greeterpid)
         close_greeter();
+  }
 
     fprintf(ldmlog, "Executing rc files.\n");
     rc_files("start");                      /* Execute any rc files */
--- ldm-0.1~bzr20071217/src/greeter_iface.c	2007-12-18 01:36:17.000000000 +0100
+++ ldm-0.1~bzr20071217.new/src/greeter_iface.c	2008-01-26 02:15:49.000000000 +0100
@@ -129,7 +129,13 @@
 get_host()
 {
     char *cmd = "hostname\n";
+    char *p;
 
+    if (ldminfo.autologin) {
+	p = getenv("SERVER");
+        scopy(ldminfo.server, p);
+        return 0;
+    }
     write(ldminfo.greeterwfd, cmd, strlen(cmd));
     return get_greeter_string(ldminfo.server, sizeof ldminfo.server);
 }
@@ -141,8 +147,10 @@
     char lang[LDMSTRSZ];
     int status;
 
+//    if (!ldminfo.autologin) {
     write(ldminfo.greeterwfd, cmd, strlen(cmd));
     status =  get_greeter_string(lang, sizeof lang);
+//    }
     if (*(ldminfo.lang) != '\0')
         return 0;                           /* admin has set LDM_LANGUAGE */
     if (strncmp(lang, "None", 4))          /* If "None", use default */
@@ -157,8 +165,10 @@
     char session[LDMSTRSZ];
     int status;
 
+//    if (!ldminfo.autologin) {
     write(ldminfo.greeterwfd, cmd, strlen(cmd));
     status =  get_greeter_string(session, sizeof session);
+//    }
     if (strncmp(session, "None", 4))        /* If "None", use default */
         scopy(ldminfo.session, session);
     return status;


-- System Information:
Debian Release: 4.0
  APT prefers proposed-updates
  APT policy: (500, 'proposed-updates'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-5-686
Locale: LANG=hu_HU, LC_CTYPE=hu_HU (charmap=ISO-8859-2)





More information about the Pkg-ltsp-devel mailing list