diff options
Diffstat (limited to 'net/ja-samba/patches/patch-ao')
-rw-r--r-- | net/ja-samba/patches/patch-ao | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/net/ja-samba/patches/patch-ao b/net/ja-samba/patches/patch-ao new file mode 100644 index 00000000000..e7f689dbd87 --- /dev/null +++ b/net/ja-samba/patches/patch-ao @@ -0,0 +1,57 @@ +$NetBSD: patch-ao,v 1.1 2003/03/29 08:18:50 taca Exp $ + +Expand & in the gecos field to a capitalized login name. + +--- lib/util_getent.c.orig Sat Feb 2 19:46:42 2002 ++++ lib/util_getent.c Sun Oct 13 21:37:56 2002 +@@ -155,6 +155,11 @@ + struct sys_pwent *plist; + struct sys_pwent *pent; + struct passwd *pwd; ++#ifdef BSD ++# define BUFLEN 1024 ++ char *bp, *gecos, *p, buf[BUFLEN]; ++ int buflen; ++#endif + + pent = (struct sys_pwent *) malloc(sizeof(struct sys_pwent)); + if (pent == NULL) { +@@ -178,9 +183,38 @@ + pent->pw_uid = pwd->pw_uid; + pent->pw_gid = pwd->pw_gid; + if (pwd->pw_gecos) { ++#ifdef BSD ++ gecos = pwd->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 */ ++ goto gecos_done; ++ if (*p == '&') { ++ /* interpolate full name */ ++ snprintf(bp, BUFLEN - (bp - buf), ++ "%s", pwd->pw_name); ++ *bp = toupper(*bp); ++ bp += strlen(bp); ++ } ++ else ++ *bp++ = *p; ++ } ++ *bp = '\0'; ++ if ((pent->pw_name = strdup(buf)) == NULL) ++ goto err; ++#else + if ((pent->pw_name = strdup(pwd->pw_gecos)) == NULL) + goto err; ++#endif + } ++#ifdef BSD ++ gecos_done: ++#endif + if (pwd->pw_dir) { + if ((pent->pw_name = strdup(pwd->pw_dir)) == NULL) + goto err; |