From c6e37d8db0cd89a84a54a0cedfeacf50fb3f7a4c Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 20 Oct 1997 16:25:19 +0000 Subject: added "domain groups" parameter, allowing you to specify the groups that the user belongs to. it would be nice to know exactly what the domain groups _are_.... --- source/include/proto.h | 4 +++- source/lib/util.c | 28 ++++++++++++++++++++++++++++ source/param/loadparm.c | 4 ++++ source/pipenetlog.c | 8 ++++++-- 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/source/include/proto.h b/source/include/proto.h index e12ea4002d7..97212ff74da 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -165,6 +165,7 @@ char *lp_nis_home_map_name(void); char *lp_announce_version(void); char *lp_netbios_aliases(void); char *lp_domainsid(void); +char *lp_domain_groups(void); BOOL lp_dns_proxy(void); BOOL lp_wins_support(void); BOOL lp_wins_proxy(void); @@ -1090,7 +1091,7 @@ BOOL zero_ip(struct in_addr ip); void reset_globals_after_fork(); char *client_name(void); char *client_addr(void); -char *automount_server(char *username); +char *automount_server(char *user_name); void standard_sub_basic(char *str); BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask); int PutUniCode(char *dst,char *src); @@ -1122,3 +1123,4 @@ char *align2(char *q, char *base); char *align_offset(char *q, char *base, int align_offset_len); void dump_data(int level,char *buf1,int len); char *tab_depth(int depth); +int make_domain_gids(char *gids_str, DOM_GID *gids); diff --git a/source/lib/util.c b/source/lib/util.c index 9295d9ae73f..ec0f9f0efc9 100644 --- a/source/lib/util.c +++ b/source/lib/util.c @@ -4508,3 +4508,31 @@ char *tab_depth(int depth) spaces[depth * 4] = 0; return spaces; } + +int make_domain_gids(char *gids_str, DOM_GID *gids) +{ + char *ptr; + pstring s2; + int count; + + DEBUG(4,("make_domain_gids: %s\n", gids_str)); + + if (gids_str == NULL || *gids_str == 0) return 0; + + for (count = 0, ptr = gids_str; next_token(&ptr, s2, NULL) && count < LSA_MAX_GROUPS; count++) + { + /* the entries are of the form GID/ATTR, ATTR being optional.*/ + char *attr; + + attr = strchr(s2,'/'); + if (attr) *attr++ = 0; + if (!attr || !*attr) attr = "7"; /* default value for attribute is 7 */ + + gids[count].gid = atoi(s2); + gids[count].attr = atoi(attr); + + DEBUG(5,("group id: %d attr: %d\n", gids[count].gid, gids[count].attr)); + } + + return count; +} diff --git a/source/param/loadparm.c b/source/param/loadparm.c index 9a268193978..32fc538886a 100644 --- a/source/param/loadparm.c +++ b/source/param/loadparm.c @@ -143,6 +143,7 @@ typedef struct char *szAnnounceVersion; /* This is initialised in init_globals */ char *szNetbiosAliases; char *szDomainSID; + char *szDomainGroups; int max_log_size; int mangled_stack; int max_xmit; @@ -442,6 +443,7 @@ struct parm_struct {"valid chars", P_STRING, P_GLOBAL, &Globals.szValidChars, handle_valid_chars}, {"workgroup", P_USTRING, P_GLOBAL, &Globals.szWorkGroup, NULL}, {"domain sid", P_USTRING, P_GLOBAL, &Globals.szDomainSID, NULL}, + {"domain groups", P_USTRING, P_GLOBAL, &Globals.szDomainGroups, NULL}, {"domain controller",P_STRING, P_GLOBAL, &Globals.szDomainController,NULL}, {"username map", P_STRING, P_GLOBAL, &Globals.szUsernameMap, NULL}, {"character set", P_STRING, P_GLOBAL, &Globals.szCharacterSet, handle_character_set}, @@ -629,6 +631,7 @@ static void init_globals(void) /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */ string_set(&Globals.szLogonHome, "\\\\%N\\%U"); string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile"); + string_set(&Globals.szDomainGroups, "776/7"); Globals.bLoadPrinters = True; Globals.bUseRhosts = False; Globals.max_packet = 65535; @@ -858,6 +861,7 @@ FN_GLOBAL_STRING(lp_announce_version,&Globals.szAnnounceVersion) FN_GLOBAL_STRING(lp_netbios_aliases,&Globals.szNetbiosAliases) FN_GLOBAL_STRING(lp_domainsid,&Globals.szDomainSID) +FN_GLOBAL_STRING(lp_domain_groups,&Globals.szDomainGroups) FN_GLOBAL_BOOL(lp_dns_proxy,&Globals.bDNSproxy) FN_GLOBAL_BOOL(lp_wins_support,&Globals.bWINSsupport) diff --git a/source/pipenetlog.c b/source/pipenetlog.c index d407e006610..0563a615913 100644 --- a/source/pipenetlog.c +++ b/source/pipenetlog.c @@ -499,6 +499,8 @@ static void api_lsa_sam_logon( user_struct *vuser, if (vuser != NULL) { + DOM_GID gids[LSA_MAX_GROUPS]; + int num_gids; NTTIME dummy_time; pstring logon_script; pstring profile_path; @@ -527,6 +529,8 @@ static void api_lsa_sam_logon( user_struct *vuser, pstrcpy(home_drive , lp_logon_drive ()); pstrcpy(home_dir , lp_logon_home ()); + num_gids = make_domain_gids(lp_domain_groups(), gids); + sam_logon_in_ssb = False; pstrcpy(my_name , myname ); @@ -553,8 +557,8 @@ static void api_lsa_sam_logon( user_struct *vuser, vuser->uid, /* uint32 user_id */ vuser->gid, /* uint32 group_id */ - 0, /* uint32 num_groups */ - NULL, /* DOM_GID *gids */ + num_gids, /* uint32 num_groups */ + gids, /* DOM_GID *gids */ 0x20, /* uint32 user_flgs */ NULL, /* char sess_key[16] */ -- cgit v1.2.1