Thanks to Petter for doing a very good job on cleaning up the mess I
offered him as a patch.

But one last thing is not correct. While negating the logical expression
in the if block I did miss the second part.

Here is the correct patch:


--- libpam-foreground-0.2.orig/pam_foreground.c 2006-01-24 02:00:42.000000000 
+0100
+++ libpam-foreground-0.2/pam_foreground.c      2007-07-07 00:35:29.968989507 
+0200
@@ -76,6 +76,7 @@
        struct vt_stat vtstat;
        size_t len;
        int retval;
+       void *rhost=NULL;
 
        retval = pam_get_user(pamh, &user, NULL);
        if (retval != PAM_SUCCESS) {
@@ -83,6 +84,17 @@
                return retval;
        }
 
+       retval =  pam_get_item(pamh, PAM_RHOST, (const void **)&rhost);
+       if (retval != PAM_SUCCESS) {
+               D(("get remote host returned error: %s", 
pam_strerror(pamh,retval)));
+               return retval;
+       }
+
+       /* Skip lockfile creation when non-local */
+       if (rhost != NULL && *(char *)rhost != '\0') {
+           return PAM_SUCCESS;
+       }
+
        if (stat (AUTH_DIR, &finfo)) {
                if (errno != ENOENT) {
                        D(("Can't access %s - %s\n", AUTH_DIR, 

Attachment: signature.asc
Description: Digital signature

Reply via email to