Module Name:    othersrc
Committed By:   lukem
Date:           Tue Jan 29 13:30:32 UTC 2019

Modified Files:
        othersrc/libexec/tnftpd: configure.ac
        othersrc/libexec/tnftpd/src: ftpd.c

Log Message:
save passwd.pw_class if it exists

Add autoconf check for struct passwd.pw_class.
If pw_class is present, save it in sgetpwnam().
Inspired by FreeBSD head/libexec/ftpd/ftpd.c revision 261885.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 othersrc/libexec/tnftpd/configure.ac
cvs rdiff -u -r1.35 -r1.36 othersrc/libexec/tnftpd/src/ftpd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/libexec/tnftpd/configure.ac
diff -u othersrc/libexec/tnftpd/configure.ac:1.41 othersrc/libexec/tnftpd/configure.ac:1.42
--- othersrc/libexec/tnftpd/configure.ac:1.41	Tue Jan 29 13:06:14 2019
+++ othersrc/libexec/tnftpd/configure.ac	Tue Jan 29 13:30:32 2019
@@ -1,4 +1,4 @@
-# $NetBSD: configure.ac,v 1.41 2019/01/29 13:06:14 lukem Exp $
+# $NetBSD: configure.ac,v 1.42 2019/01/29 13:30:32 lukem Exp $
 #
 # Process this file with autoconf to produce a configure script.
 
@@ -9,7 +9,7 @@ AC_COPYRIGHT([
 Copyright (c) 2001-2019 The NetBSD Foundation, Inc.
 All rights reserved.
 ])
-AC_REVISION([$Revision: 1.41 $])
+AC_REVISION([$Revision: 1.42 $])
 
 AS_SHELL_SANITIZE()
 
@@ -243,7 +243,9 @@ AC_TYPE_SIZE_T()
 AC_STRUCT_TM()
 AC_CHECK_MEMBERS([struct sockaddr.sa_len, struct sockaddr_in.sin_len,
                   DIR.dd_fd, DIR.__dd_fd, struct dirent.d_namlen,
-                  struct passwd.pw_change, struct passwd.pw_expire],
+                  struct passwd.pw_change,
+                  struct passwd.pw_class,
+                  struct passwd.pw_expire],
                  [], [], [$accheck_includes])
 AC_CHECK_TYPES([in_port_t, sa_family_t, socklen_t, struct addrinfo],
                [], [], [$accheck_includes])

Index: othersrc/libexec/tnftpd/src/ftpd.c
diff -u othersrc/libexec/tnftpd/src/ftpd.c:1.35 othersrc/libexec/tnftpd/src/ftpd.c:1.36
--- othersrc/libexec/tnftpd/src/ftpd.c:1.35	Tue Jan 29 12:14:46 2019
+++ othersrc/libexec/tnftpd/src/ftpd.c	Tue Jan 29 13:30:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ftpd.c,v 1.35 2019/01/29 12:14:46 lukem Exp $	*/
+/*	$NetBSD: ftpd.c,v 1.36 2019/01/29 13:30:32 lukem Exp $	*/
 /*	from	NetBSD: ftpd.c,v 1.204 2018/04/28 13:38:00 riastradh Exp	*/
 
 /*
@@ -946,6 +946,9 @@ sgetpwnam(const char *name)
 		free((char *)save.pw_gecos);
 		free((char *)save.pw_dir);
 		free((char *)save.pw_shell);
+#if defined(HAVE_STRUCT_PASSWD_PW_CLASS)
+		free((char *)save.pw_class);
+#endif
 	}
 	save = *p;
 	save.pw_name = ftpd_strdup(p->pw_name);
@@ -953,6 +956,9 @@ sgetpwnam(const char *name)
 	save.pw_gecos = ftpd_strdup(p->pw_gecos);
 	save.pw_dir = ftpd_strdup(p->pw_dir);
 	save.pw_shell = ftpd_strdup(p->pw_shell);
+#if defined(HAVE_STRUCT_PASSWD_PW_CLASS)
+	save.pw_class = ftpd_strdup(p->pw_class);
+#endif
 	return (&save);
 }
 

Reply via email to