Farhan/openssh
Révision | 3d8b46a4c6de53f3001781964a84f8049993b8c6 (tree) |
---|---|
l'heure | 2011-12-29 03:59:08 |
Auteur | Mike Lockwood <lockwood@goog...> |
Commiter | Mike Lockwood |
Add HAVE_PW_GECOS_IN_PASSWD configuration flag
Change-Id: I2571f00b4b6ba41b7795c8c78c58253e5d0205dd
Signed-off-by: Mike Lockwood <lockwood@google.com>
@@ -682,7 +682,9 @@ fakepw(void) | ||
682 | 682 | fake.pw_name = "NOUSER"; |
683 | 683 | fake.pw_passwd = |
684 | 684 | "$2a$06$r3.juUaHZDlIbQaO2dS9FuYxL1W9M81R1Tc92PoSNmzvpEqLkLGrK"; |
685 | +#ifdef HAVE_PW_GECOS_IN_PASSWD | |
685 | 686 | fake.pw_gecos = "NOUSER"; |
687 | +#endif | |
686 | 688 | fake.pw_uid = privsep_pw == NULL ? (uid_t)-1 : privsep_pw->pw_uid; |
687 | 689 | fake.pw_gid = privsep_pw == NULL ? (gid_t)-1 : privsep_pw->pw_gid; |
688 | 690 | #ifdef HAVE_PW_CLASS_IN_PASSWD |
@@ -732,6 +732,9 @@ | ||
732 | 732 | /* Define if your password has a pw_change field */ |
733 | 733 | #undef HAVE_PW_CHANGE_IN_PASSWD |
734 | 734 | |
735 | +/* Define if your password has a pw_gecos field */ | |
736 | +#undef HAVE_PW_GECOS_IN_PASSWD | |
737 | + | |
735 | 738 | /* Define if your password has a pw_class field */ |
736 | 739 | #undef HAVE_PW_CLASS_IN_PASSWD |
737 | 740 |
@@ -13620,6 +13620,40 @@ $as_echo "#define HAVE_PW_CHANGE_IN_PASSWD 1" >>confdefs.h | ||
13620 | 13620 | |
13621 | 13621 | fi |
13622 | 13622 | |
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 | + | |
13623 | 13657 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msg_accrights field in struct msghdr" >&5 |
13624 | 13658 | $as_echo_n "checking for msg_accrights field in struct msghdr... " >&6; } |
13625 | 13659 | if ${ac_cv_have_accrights_in_msghdr+:} false; then : |
@@ -3100,6 +3100,19 @@ if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then | ||
3100 | 3100 | [Define if your password has a pw_change field]) |
3101 | 3101 | fi |
3102 | 3102 | |
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 | + | |
3103 | 3116 | dnl make sure we're using the real structure members and not defines |
3104 | 3117 | AC_CACHE_CHECK([for msg_accrights field in struct msghdr], |
3105 | 3118 | ac_cv_have_accrights_in_msghdr, [ |
@@ -205,8 +205,10 @@ pwcopy(struct passwd *pw) | ||
205 | 205 | struct passwd *copy = xcalloc(1, sizeof(*copy)); |
206 | 206 | |
207 | 207 | 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 | |
209 | 210 | copy->pw_gecos = xstrdup(pw->pw_gecos); |
211 | +#endif | |
210 | 212 | copy->pw_uid = pw->pw_uid; |
211 | 213 | copy->pw_gid = pw->pw_gid; |
212 | 214 | #ifdef HAVE_PW_EXPIRE_IN_PASSWD |
@@ -761,7 +761,9 @@ mm_answer_pwnamallow(int sock, Buffer *m) | ||
761 | 761 | buffer_put_string(m, pwent, sizeof(struct passwd)); |
762 | 762 | buffer_put_cstring(m, pwent->pw_name); |
763 | 763 | buffer_put_cstring(m, "*"); |
764 | +#ifdef HAVE_PW_GECOS_IN_PASSWD | |
764 | 765 | buffer_put_cstring(m, pwent->pw_gecos); |
766 | +#endif | |
765 | 767 | #ifdef HAVE_PW_CLASS_IN_PASSWD |
766 | 768 | buffer_put_cstring(m, pwent->pw_class); |
767 | 769 | #endif |
@@ -259,7 +259,9 @@ mm_getpwnamallow(const char *username) | ||
259 | 259 | fatal("%s: struct passwd size mismatch", __func__); |
260 | 260 | pw->pw_name = buffer_get_string(&m, NULL); |
261 | 261 | pw->pw_passwd = buffer_get_string(&m, NULL); |
262 | +#ifdef HAVE_PW_GECOS_IN_PASSWD | |
262 | 263 | pw->pw_gecos = buffer_get_string(&m, NULL); |
264 | +#endif | |
263 | 265 | #ifdef HAVE_PW_CLASS_IN_PASSWD |
264 | 266 | pw->pw_class = buffer_get_string(&m, NULL); |
265 | 267 | #endif |