Update of bug #66059 (group screen):

                  Status:                    None => Ready For Test         

    _______________________________________________________

Follow-up Comment #1:

https://man.openbsd.org/getpwuid_shadow.3
https://github.com/openbsd/src/blob/master/include/pwd.h#L80

Well, ok... what's about this:


diff --git a/src/socket.c b/src/socket.c
index 9c5b8b9..5709a24 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -47,9 +47,13 @@
 #include <signal.h>
 
 #if ENABLE_PAM
-#include <security/pam_appl.h>
+  #include <security/pam_appl.h>
 #else
-#include <shadow.h>
+  #ifdef _PWD_H_
+    #include <pwd.h>
+  #else
+    #include <shadow.h>
+  #endif /* PWD_H */
 #endif
 
 #include "screen.h"
@@ -1203,13 +1207,27 @@ static bool CheckPassword(const char *password) {
 static bool CheckPassword(const char *password) {
        bool ret = false;
        char *passwd = 0;
+
+#ifndef _PWD_H
+       struct passwd *p;
+#else
        struct spwd *p;
+#endif
+
        gid_t gid = getegid();
        uid_t uid = geteuid();
 
        if (seteuid(0) || setegid(0))
                Panic(0, "\r\ncan't get root uid/gid\r\n");
+
+#ifndef _PWD_H
+       p = getpwnam_shadow(ppp->pw_name);
+#else
        p = getspnam(ppp->pw_name);
+#endif
+       if (p == NULL)
+               return false;
+
        if (seteuid(uid) || setegid(gid))
                Panic(0, "\r\ncan't restore uid/gid\r\n");
 
@@ -1217,11 +1235,13 @@ static bool CheckPassword(const char *password) {
                AddStr("\r\ncan't open passwd file\r\n");
                return false;
        }
-
+#ifndef _PWD_H
+       passwd = crypt(password, p->pw_passwd);
+       ret    = (strcmp(passwd, p->pw_passwd) == 0);
+#else
        passwd = crypt(password, p->sp_pwdp);
-
        ret = (strcmp(passwd, p->sp_pwdp) == 0);
-
+#endif
        return ret;
 }
 #endif /* ENABLE_PAM */




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?66059>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to