*** loadparm.c.orig Sat Feb 27 16:09:01 1999 --- loadparm.c Mon Apr 5 14:32:56 1999 *************** *** 1848,1859 **** --- 1848,1899 ---- /*************************************************************************** handle the include operation ***************************************************************************/ static BOOL handle_include(char *pszParmValue,char **ptr) { + extern BOOL sam_logon_in_ssb; + extern pstring samlogon_user; + extern pstring sesssetup_user; + /* should sesssetup_user always be used here? AAB */ + char *username = sam_logon_in_ssb ? samlogon_user : sesssetup_user; pstring fname; + pstrcpy(fname,pszParmValue); + + if (strstr(fname, "%X")) { + int i; + pstring newfname; + struct passwd *pass; + int ngroups; + gid_t *groups; + + if ((pass = Get_Pwnam(username,False))==NULL) + return(False); /* user doesn't exist */ + + initgroups(username, pass->pw_gid); + ngroups = sys_getgroups(0,groups); + if (ngroups <= 0) { ngroups = 32; } + DEBUG(3, ("%s is in %d groups\n", username, ngroups)); + if ((groups = (gid_t *)malloc(sizeof(gid_t)*ngroups)) == NULL) { + DEBUG(0,("groups malloc failed!\n")); + return(False); + } + ngroups = sys_getgroups(ngroups,groups); + + for (i=0 ; i < ngroups ; i++) { + pstrcpy(newfname, fname); + string_sub(newfname, "%X", gidtoname(groups[i])); + /* remember the filename here because ssb doesn't do %X substitution AAB */ + add_to_file_list(newfname); + standard_sub_basic(newfname); + DEBUG(3,("newfname after sub = %s\n", newfname)); + if (file_exist(newfname,NULL)) + pm_process(newfname, do_section, do_parameter); + } + free(groups); + return(False); + } add_to_file_list(fname); standard_sub_basic(fname);