• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Farhan/openssh


Commit MetaInfo

Révision3d8b46a4c6de53f3001781964a84f8049993b8c6 (tree)
l'heure2011-12-29 03:59:08
AuteurMike Lockwood <lockwood@goog...>
CommiterMike Lockwood

Message de Log

Add HAVE_PW_GECOS_IN_PASSWD configuration flag

Change-Id: I2571f00b4b6ba41b7795c8c78c58253e5d0205dd
Signed-off-by: Mike Lockwood <lockwood@google.com>

Change Summary

Modification

--- a/auth.c
+++ b/auth.c
@@ -682,7 +682,9 @@ fakepw(void)
682682 fake.pw_name = "NOUSER";
683683 fake.pw_passwd =
684684 "$2a$06$r3.juUaHZDlIbQaO2dS9FuYxL1W9M81R1Tc92PoSNmzvpEqLkLGrK";
685+#ifdef HAVE_PW_GECOS_IN_PASSWD
685686 fake.pw_gecos = "NOUSER";
687+#endif
686688 fake.pw_uid = privsep_pw == NULL ? (uid_t)-1 : privsep_pw->pw_uid;
687689 fake.pw_gid = privsep_pw == NULL ? (gid_t)-1 : privsep_pw->pw_gid;
688690 #ifdef HAVE_PW_CLASS_IN_PASSWD
--- a/config.h.in
+++ b/config.h.in
@@ -732,6 +732,9 @@
732732 /* Define if your password has a pw_change field */
733733 #undef HAVE_PW_CHANGE_IN_PASSWD
734734
735+/* Define if your password has a pw_gecos field */
736+#undef HAVE_PW_GECOS_IN_PASSWD
737+
735738 /* Define if your password has a pw_class field */
736739 #undef HAVE_PW_CLASS_IN_PASSWD
737740
--- a/configure
+++ b/configure
@@ -13620,6 +13620,40 @@ $as_echo "#define HAVE_PW_CHANGE_IN_PASSWD 1" >>confdefs.h
1362013620
1362113621 fi
1362213622
13623+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pw_gecos field in struct passwd" >&5
13624+$as_echo_n "checking for pw_gecos field in struct passwd... " >&6; }
13625+if ${ac_cv_have_pw_gecos_in_struct_passwd+:} false; then :
13626+ $as_echo_n "(cached) " >&6
13627+else
13628+
13629+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13630+/* end confdefs.h. */
13631+ #include <pwd.h>
13632+int
13633+main ()
13634+{
13635+ struct passwd p; p.pw_gecos = 0;
13636+ ;
13637+ return 0;
13638+}
13639+_ACEOF
13640+if ac_fn_c_try_compile "$LINENO"; then :
13641+ ac_cv_have_pw_gecos_in_struct_passwd="yes"
13642+else
13643+ ac_cv_have_pw_gecos_in_struct_passwd="no"
13644+
13645+fi
13646+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13647+
13648+fi
13649+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_pw_gecos_in_struct_passwd" >&5
13650+$as_echo "$ac_cv_have_pw_gecos_in_struct_passwd" >&6; }
13651+if test "x$ac_cv_have_pw_gecos_in_struct_passwd" = "xyes" ; then
13652+
13653+$as_echo "#define HAVE_PW_GECOS_IN_PASSWD 1" >>confdefs.h
13654+
13655+fi
13656+
1362313657 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msg_accrights field in struct msghdr" >&5
1362413658 $as_echo_n "checking for msg_accrights field in struct msghdr... " >&6; }
1362513659 if ${ac_cv_have_accrights_in_msghdr+:} false; then :
--- a/configure.ac
+++ b/configure.ac
@@ -3100,6 +3100,19 @@ if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
31003100 [Define if your password has a pw_change field])
31013101 fi
31023102
3103+AC_CACHE_CHECK([for pw_gecos field in struct passwd],
3104+ ac_cv_have_pw_gecos_in_struct_passwd, [
3105+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3106+ [[ struct passwd p; p.pw_gecos = 0; ]])],
3107+ [ ac_cv_have_pw_gecos_in_struct_passwd="yes" ],
3108+ [ ac_cv_have_pw_gecos_in_struct_passwd="no"
3109+ ])
3110+])
3111+if test "x$ac_cv_have_pw_gecos_in_struct_passwd" = "xyes" ; then
3112+ AC_DEFINE([HAVE_PW_GECOS_IN_PASSWD], [1],
3113+ [Define if your password has a pw_gecos field])
3114+fi
3115+
31033116 dnl make sure we're using the real structure members and not defines
31043117 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
31053118 ac_cv_have_accrights_in_msghdr, [
--- a/misc.c
+++ b/misc.c
@@ -205,8 +205,10 @@ pwcopy(struct passwd *pw)
205205 struct passwd *copy = xcalloc(1, sizeof(*copy));
206206
207207 copy->pw_name = xstrdup(pw->pw_name);
208- copy->pw_passwd = xstrdup(pw->pw_passwd);
208+ copy->pw_passwd = pw->pw_passwd ? xstrdup(pw->pw_passwd) : NULL;
209+#ifdef HAVE_PW_GECOS_IN_PASSWD
209210 copy->pw_gecos = xstrdup(pw->pw_gecos);
211+#endif
210212 copy->pw_uid = pw->pw_uid;
211213 copy->pw_gid = pw->pw_gid;
212214 #ifdef HAVE_PW_EXPIRE_IN_PASSWD
--- a/monitor.c
+++ b/monitor.c
@@ -761,7 +761,9 @@ mm_answer_pwnamallow(int sock, Buffer *m)
761761 buffer_put_string(m, pwent, sizeof(struct passwd));
762762 buffer_put_cstring(m, pwent->pw_name);
763763 buffer_put_cstring(m, "*");
764+#ifdef HAVE_PW_GECOS_IN_PASSWD
764765 buffer_put_cstring(m, pwent->pw_gecos);
766+#endif
765767 #ifdef HAVE_PW_CLASS_IN_PASSWD
766768 buffer_put_cstring(m, pwent->pw_class);
767769 #endif
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -259,7 +259,9 @@ mm_getpwnamallow(const char *username)
259259 fatal("%s: struct passwd size mismatch", __func__);
260260 pw->pw_name = buffer_get_string(&m, NULL);
261261 pw->pw_passwd = buffer_get_string(&m, NULL);
262+#ifdef HAVE_PW_GECOS_IN_PASSWD
262263 pw->pw_gecos = buffer_get_string(&m, NULL);
264+#endif
263265 #ifdef HAVE_PW_CLASS_IN_PASSWD
264266 pw->pw_class = buffer_get_string(&m, NULL);
265267 #endif