diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index e8458fd..f96400d 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -33,6 +33,34 @@ #include "includes.h" +#if defined(HPUX) +/***************************************************** + Prevent uid and gid from negative numbers + If found invallid uid/gid for guest account, return 1. + Otherwise return 0. + *****************************************************/ +int check_valid_guestaccount() +{ + struct passwd *pw; + fstring guser; + int ret=0; + + fstrcpy(guser,lp_guestaccount()); + pw=sys_getpwnam(guser); + + if (!pw) { + fprintf(stderr, "ERROR: Not found the user %s as guest account from /etc/passwd\n", guser); + ret = 1; + } else { + if ( pw->pw_uid < 0 || pw->pw_gid < 0 ) { + fprintf(stderr, "ERROR: Invalid uid/gid as guest account = %s on global due to nagetive values\n", guser); + ret = 1; + } + } + return ret; +} +#endif + extern bool AllowDebugChange; /*********************************************** @@ -211,6 +239,21 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_ } #endif +#if defined(HPUX) + /* + * Protect the valid user as guest account from negative uid and gid. + * When guest account is set to a user with negative uid or gid, + * we suggest Administrator to use smbnull as guest account for HP_UX + * in smb.conf. + */ + if (check_valid_guestaccount()) + { + fprintf(stderr, "Recommend: Please use smbnull as guest account on [global]\n"); + fprintf(stderr, " or change invalid uid/gid to positive numbers.\n\n"); + ret = 1; + } +#endif /* HPUX */ + if (!lp_passdb_backend()) { fprintf(stderr,"ERROR: passdb backend must have a value or be left out\n"); }