pkgsrc/net/samba2/patches/patch-aq
jlam 1fc97f0df8 Reimport net/samba as net/samba2. net/samba2 will continue to track the
2.x release of Samba, which net/samba will track post-2.x releases of
Samba.
2004-01-11 00:41:12 +00:00

56 lines
1.3 KiB
Text

$NetBSD: patch-aq,v 1.1.1.1 2004/01/11 00:41:13 jlam Exp $
Expand & in the gecos field to a capitalized login name.
--- lib/system.c.orig Thu May 2 21:03:10 2002
+++ lib/system.c Sun Oct 13 21:36:59 2002
@@ -773,6 +773,12 @@
static void copy_pwent(struct saved_pw *dst, struct passwd *pass)
{
+#ifdef BSD
+# define BUFLEN 1024
+ char *bp, *gecos, *p, buf[BUFLEN];
+ int buflen;
+#endif
+
memcpy((char *)&dst->pass, pass, sizeof(struct passwd));
fstrcpy(dst->pw_name, pass->pw_name);
@@ -781,7 +787,36 @@
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;
+
+ /* 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;
+ }
+ 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;
+
+ gecos_done:
+ fstrcpy(dst->pw_gecos, gecos);
+#else
fstrcpy(dst->pw_gecos, pass->pw_gecos);
+#endif
dst->pass.pw_gecos = dst->pw_gecos;
pstrcpy(dst->pw_dir, pass->pw_dir);