]> git.pld-linux.org Git - packages/cracklib.git/commitdiff
- use getpwuid_r instead of getpwuid (patch from rawhide).
authorkloczek <kloczek@pld-linux.org>
Wed, 21 Nov 2001 13:28:54 +0000 (13:28 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    cracklib-nss.patch -> 1.1

cracklib-nss.patch [new file with mode: 0644]

diff --git a/cracklib-nss.patch b/cracklib-nss.patch
new file mode 100644 (file)
index 0000000..30f90b8
--- /dev/null
@@ -0,0 +1,49 @@
+--- cracklib,2.7/cracklib/fascist.c    Tue Oct  2 15:58:43 2001
++++ cracklib,2.7/cracklib/fascist.c    Tue Oct  2 16:06:44 2001
+@@ -10,6 +10,8 @@
+ #include "packer.h"
+ #include <sys/types.h>
++#include <errno.h>
++#include <limits.h>
+ #include <pwd.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -488,13 +490,35 @@
+     int wc;
+     char *ptr;
+     int gwords;
+-    struct passwd *pwp;
++    struct passwd *pwp, passwd;
+     char gbuffer[STRINGSIZE];
+     char tbuffer[STRINGSIZE];
++    char *sbuffer;
++    size_t sbufferlen;
+     char *uwords[STRINGSIZE];
+     char longbuffer[STRINGSIZE * 2];
+-    if (!(pwp = getpwuid(uid)))
++    sbuffer = malloc(sbufferlen = LINE_MAX);
++    if (sbuffer == NULL)
++    {
++        return ("memory allocation error");
++    }
++    while ((i = getpwuid_r(uid, &passwd, sbuffer, sbufferlen, &pwp)) != 0)
++    {
++        if (i == ERANGE)
++        {
++            free(sbuffer);
++            sbuffer = malloc(sbufferlen += LINE_MAX);
++            if (sbuffer == NULL)
++            {
++                return ("memory allocation error");
++            }
++        } else {
++            pwp = NULL;
++            break;
++        }
++    }
++    if (pwp == NULL)
+     {
+       return ("you are not registered in the password file");
+     }
This page took 0.074046 seconds and 4 git commands to generate.