diff options
Diffstat (limited to 'net/ja-samba/patches/patch-ap')
-rw-r--r-- | net/ja-samba/patches/patch-ap | 71 |
1 files changed, 38 insertions, 33 deletions
diff --git a/net/ja-samba/patches/patch-ap b/net/ja-samba/patches/patch-ap index ca6dd135403..37e625f16ae 100644 --- a/net/ja-samba/patches/patch-ap +++ b/net/ja-samba/patches/patch-ap @@ -1,54 +1,59 @@ -$NetBSD: patch-ap,v 1.3 2004/06/05 13:16:35 taca Exp $ +$NetBSD: patch-ap,v 1.4 2004/07/23 16:45:43 taca Exp $ Expand & in the gecos field to a capitalized login name. --- lib/system.c.orig 2003-07-17 20:23:53.000000000 +0900 +++ lib/system.c -@@ -776,12 +776,47 @@ static int num_lookups; /* Counter so we +@@ -776,6 +776,11 @@ static int num_lookups; /* Counter so we static void copy_pwent(struct saved_pw *dst, struct passwd *pass) { +#ifdef BSD -+# define BUFLEN 1024 -+ char *bp, *gecos, *p, buf[BUFLEN]; -+ int buflen; ++ char *bp, *gecos, *p; ++ pstring buf, buf2; +#endif + memcpy((char *)&dst->pass, pass, sizeof(struct passwd)); unix_to_dos(dst->pw_name, pass->pw_name); - dst->pass.pw_name = dst->pw_name; +@@ -783,9 +788,39 @@ static void copy_pwent(struct saved_pw * + fstrcpy(dst->pw_passwd, pass->pw_passwd); + dst->pass.pw_passwd = dst->pw_passwd; +#ifdef BSD -+ gecos = pass->pw_gecos; -+ if (*gecos == '*') -+ gecos++; -+ bp = buf; ++ if (pass->pw_gecos) { ++ gecos = pass->pw_gecos; ++ if (*gecos == '*') ++ gecos++; ++ bp = buf; + -+ /* copy gecos, interpolating & to be full name */ -+ for (p = gecos; *p != '\0'; p++) { -+ if (bp >= &buf[BUFLEN - 1]) { -+ /* buffer overflow */ -+ gecos = pass->pw_name; -+ goto gecos_done; ++ /* copy gecos, interpolating & to be full name */ ++ for (p = gecos; *p != '\0'; p++) { ++ if (bp >= &buf[PSTRING_LEN - 1]) { ++ /* buffer overflow */ ++ gecos = pass->pw_name; ++ goto gecos_done; ++ } ++ if (*p == '&') { ++ /* interpolate full name */ ++ snprintf(bp, PSTRING_LEN - (bp - buf), "%s", ++ pass->pw_name); ++ *bp = toupper(*bp); ++ bp += strlen(bp); ++ } ++ else ++ *bp++ = *p; + } -+ if (*p == '&') { -+ /* interpolate full name */ -+ snprintf(bp, BUFLEN - (bp - buf), "%s", pass->pw_name); -+ *bp = toupper(*bp); -+ bp += strlen(bp); -+ } -+ else -+ *bp++ = *p; ++ *bp = '\0'; ++ gecos = buf; + +- unix_to_dos(dst->pw_gecos, pass->pw_gecos); ++ gecos_done: ++ unix_to_dos(buf2, gecos); ++ fstrcpy(dst->pw_gecos, buf2); + } -+ *bp = '\0'; -+ gecos = buf; -+ -+ gecos_done: -+ fstrcpy(dst->pw_gecos, gecos); -+#else - fstrcpy(dst->pw_passwd, pass->pw_passwd); + dst->pass.pw_gecos = dst->pw_gecos; +#endif - dst->pass.pw_passwd = dst->pw_passwd; - unix_to_dos(dst->pw_gecos, pass->pw_gecos); + unix_to_dos(dst->pw_dir, pass->pw_dir); + dst->pass.pw_dir = dst->pw_dir; |