diff options
author | Luke Leighton <lkcl@samba.org> | 2000-04-09 04:04:42 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 2000-04-09 04:04:42 +0000 |
commit | 15b9cc4b96f36277a0b61501e8c5584f660653dc (patch) | |
tree | 63f6b9b8d6d2c9b6de2d39e7e009ea9954151944 | |
parent | 96f8ab38622ad29b0e27dec0c74087bdeb5f1073 (diff) | |
download | samba-15b9cc4b96f36277a0b61501e8c5584f660653dc.tar.gz samba-15b9cc4b96f36277a0b61501e8c5584f660653dc.tar.xz samba-15b9cc4b96f36277a0b61501e8c5584f660653dc.zip |
lp_server_role() == SERVER_ROLE_NONE was being refused. hmm. i think
i am going to call this SERVER_ROLE_STANDALONE, or maybe SERVER_ROLE_WGRP.
-rw-r--r-- | source/lib/domain_namemap.c | 448 |
1 files changed, 210 insertions, 238 deletions
diff --git a/source/lib/domain_namemap.c b/source/lib/domain_namemap.c index 46bc40a50ae..6ba22fd9bda 100644 --- a/source/lib/domain_namemap.c +++ b/source/lib/domain_namemap.c @@ -875,82 +875,76 @@ static BOOL get_sid_and_type(const char *ntdomain, *************************************************************************/ BOOL lookupsmbpwuid(uid_t uid, DOM_NAME_MAP * gmep) { + POSIX_ID id; + static fstring nt_name; + static fstring unix_name; + static fstring nt_domain; + DEBUG(10, ("lookupsmbpwuid: unix uid %d\n", uid)); if (map_username_uid(uid, gmep)) { return True; } - if (lp_server_role() != ROLE_DOMAIN_NONE) - { - POSIX_ID id; - static fstring nt_name; - static fstring unix_name; - static fstring nt_domain; - gmep->nt_name = nt_name; - gmep->unix_name = unix_name; - gmep->nt_domain = nt_domain; + gmep->nt_name = nt_name; + gmep->unix_name = unix_name; + gmep->nt_domain = nt_domain; - gmep->unix_id = (uint32)uid; + gmep->unix_id = (uint32)uid; - /* - * ok, assume it's one of ours. then double-check it - * if we are a member of a domain - */ + /* + * ok, assume it's one of ours. then double-check it + * if we are a member of a domain + */ - gmep->type = SID_NAME_USER; - fstrcpy(gmep->nt_name, uidtoname(uid)); - fstrcpy(gmep->unix_name, gmep->nt_name); + gmep->type = SID_NAME_USER; + fstrcpy(gmep->nt_name, uidtoname(uid)); + fstrcpy(gmep->unix_name, gmep->nt_name); - /* - * here we should do a LsaLookupNames() call - * to check the status of the name with the PDC. - * if the PDC know nothing of the name, it's ours. - */ + /* + * here we should do a LsaLookupNames() call + * to check the status of the name with the PDC. + * if the PDC know nothing of the name, it's ours. + */ - if (lp_server_role() == ROLE_DOMAIN_MEMBER) - { + if (lp_server_role() == ROLE_DOMAIN_MEMBER) + { #if 0 - lsa_lookup_names(global_myworkgroup, gmep->nt_name, - &gmep->sid...); + lsa_lookup_names(global_myworkgroup, gmep->nt_name, + &gmep->sid...); #endif - } + } - /* - * ok, it's one of ours. - */ + /* + * ok, it's one of ours. + */ - gmep->nt_domain = global_sam_name; + gmep->nt_domain = global_sam_name; - switch (gmep->type) + switch (gmep->type) + { + case SID_NAME_USER: { - case SID_NAME_USER: - { - id.type = SURS_POSIX_UID_AS_USR; - break; - } - case SID_NAME_DOM_GRP: - { - id.type = SURS_POSIX_GID_AS_GRP; - break; - } - case SID_NAME_ALIAS: - { - id.type = SURS_POSIX_GID_AS_ALS; - break; - } + id.type = SURS_POSIX_UID_AS_USR; + break; + } + case SID_NAME_DOM_GRP: + { + id.type = SURS_POSIX_GID_AS_GRP; + break; + } + case SID_NAME_ALIAS: + { + id.type = SURS_POSIX_GID_AS_ALS; + break; } - - id.id = gmep->unix_id; - - surs_unixid_to_sam_sid(&id, &gmep->sid, False); - - return True; } - /* oops. */ + id.id = gmep->unix_id; - return False; + surs_unixid_to_sam_sid(&id, &gmep->sid, False); + + return True; } /************************************************************************* @@ -962,6 +956,8 @@ BOOL lookupsmbpwntnam(const char *fullntname, DOM_NAME_MAP * gmep) static fstring unix_name; static fstring nt_domain; + uid_t uid; + DEBUG(10, ("lookupsmbpwntnam: nt user name %s\n", fullntname)); if (!split_domain_name(fullntname, nt_domain, nt_name)) @@ -973,34 +969,26 @@ BOOL lookupsmbpwntnam(const char *fullntname, DOM_NAME_MAP * gmep) { return True; } - if (lp_server_role() != ROLE_DOMAIN_NONE) - { - uid_t uid; - gmep->nt_name = nt_name; - gmep->unix_name = unix_name; - gmep->nt_domain = nt_domain; - - /* - * ok, it's one of ours. we therefore "create" an nt user named - * after the unix user. this is the point where "appliance mode" - * should get its teeth in, as unix users won't really exist, - * they will only be numbers... - */ + gmep->nt_name = nt_name; + gmep->unix_name = unix_name; + gmep->nt_domain = nt_domain; - gmep->type = SID_NAME_USER; - fstrcpy(gmep->unix_name, gmep->nt_name); - if (!nametouid(gmep->unix_name, &uid)) - { - return False; - } - gmep->unix_id = (uint32)uid; + /* + * ok, it's one of ours. we therefore "create" an nt user named + * after the unix user. this is the point where "appliance mode" + * should get its teeth in, as unix users won't really exist, + * they will only be numbers... + */ - return get_sid_and_type(nt_domain, nt_name, gmep->type, gmep); + gmep->type = SID_NAME_USER; + fstrcpy(gmep->unix_name, gmep->nt_name); + if (!nametouid(gmep->unix_name, &uid)) + { + return False; } + gmep->unix_id = (uint32)uid; - /* oops. */ - - return False; + return get_sid_and_type(nt_domain, nt_name, gmep->type, gmep); } /************************************************************************* @@ -1008,6 +996,11 @@ BOOL lookupsmbpwntnam(const char *fullntname, DOM_NAME_MAP * gmep) *************************************************************************/ BOOL lookupsmbpwsid(DOM_SID *sid, DOM_NAME_MAP * gmep) { + POSIX_ID id; + static fstring nt_name; + static fstring unix_name; + static fstring nt_domain; + fstring sid_str; sid_to_string(sid_str, sid); DEBUG(10, ("lookupsmbpwsid: nt sid %s\n", sid_str)); @@ -1016,70 +1009,59 @@ BOOL lookupsmbpwsid(DOM_SID *sid, DOM_NAME_MAP * gmep) { return True; } - if (lp_server_role() != ROLE_DOMAIN_NONE) + gmep->nt_name = nt_name; + gmep->unix_name = unix_name; + gmep->nt_domain = nt_domain; + + /* + * here we should do a LsaLookupNames() call + * to check the status of the name with the PDC. + * if the PDC know nothing of the name, it's ours. + */ + + if (lp_server_role() == ROLE_DOMAIN_MEMBER) { - POSIX_ID id; - static fstring nt_name; - static fstring unix_name; - static fstring nt_domain; + } - gmep->nt_name = nt_name; - gmep->unix_name = unix_name; - gmep->nt_domain = nt_domain; + /* + * ok, it's one of ours. we therefore "create" an nt user named + * after the unix user. this is the point where "appliance mode" + * should get its teeth in, as unix users won't really exist, + * they will only be numbers... + */ - /* - * here we should do a LsaLookupNames() call - * to check the status of the name with the PDC. - * if the PDC know nothing of the name, it's ours. - */ + gmep->type = SID_NAME_USER; + sid_copy(&gmep->sid, sid); + if (!surs_sam_sid_to_unixid(&gmep->sid, &id, False)) + { + return False; + } - if (lp_server_role() == ROLE_DOMAIN_MEMBER) + gmep->unix_id = id.id; + switch (id.type) + { + case SURS_POSIX_UID_AS_USR: { + gmep->type = SID_NAME_USER; + break; } - - /* - * ok, it's one of ours. we therefore "create" an nt user named - * after the unix user. this is the point where "appliance mode" - * should get its teeth in, as unix users won't really exist, - * they will only be numbers... - */ - - gmep->type = SID_NAME_USER; - sid_copy(&gmep->sid, sid); - if (!surs_sam_sid_to_unixid(&gmep->sid, &id, False)) + case SURS_POSIX_GID_AS_GRP: { - return False; + gmep->type = SID_NAME_DOM_GRP; + break; } - - gmep->unix_id = id.id; - switch (id.type) + case SURS_POSIX_GID_AS_ALS: { - case SURS_POSIX_UID_AS_USR: - { - gmep->type = SID_NAME_USER; - break; - } - case SURS_POSIX_GID_AS_GRP: - { - gmep->type = SID_NAME_DOM_GRP; - break; - } - case SURS_POSIX_GID_AS_ALS: - { - gmep->type = SID_NAME_ALIAS; - break; - } + gmep->type = SID_NAME_ALIAS; + break; } - - fstrcpy(gmep->nt_name, uidtoname((uid_t) gmep->unix_id)); - fstrcpy(gmep->unix_name, gmep->nt_name); - gmep->nt_domain = global_sam_name; - return True; } - /* oops. */ + fstrcpy(gmep->nt_name, uidtoname((uid_t) gmep->unix_id)); + fstrcpy(gmep->unix_name, gmep->nt_name); + gmep->nt_domain = global_sam_name; - return False; + return True; } /************************************************************************ @@ -1104,6 +1086,11 @@ BOOL lookupsmbgrpnam(const char *unix_grp_name, DOM_NAME_MAP * grp) *************************************************************************/ BOOL lookupsmbgrpsid(DOM_SID *sid, DOM_NAME_MAP * gmep) { + POSIX_ID id; + static fstring nt_name; + static fstring unix_name; + static fstring nt_domain; + fstring sid_str; sid_to_string(sid_str, sid); DEBUG(10, ("lookupsmbgrpsid: nt sid %s\n", sid_str)); @@ -1115,85 +1102,75 @@ BOOL lookupsmbgrpsid(DOM_SID *sid, DOM_NAME_MAP * gmep) { return True; } - if (lp_server_role() != ROLE_DOMAIN_NONE) + gmep->nt_name = nt_name; + gmep->unix_name = unix_name; + gmep->nt_domain = nt_domain; + /* + * here we should do a LsaLookupNames() call + * to check the status of the name with the PDC. + * if the PDC know nothing of the name, it's ours. + */ + if (lp_server_role() == ROLE_DOMAIN_MEMBER) { - POSIX_ID id; - static fstring nt_name; - static fstring unix_name; - static fstring nt_domain; - gmep->nt_name = nt_name; - gmep->unix_name = unix_name; - gmep->nt_domain = nt_domain; - /* - * here we should do a LsaLookupNames() call - * to check the status of the name with the PDC. - * if the PDC know nothing of the name, it's ours. - */ - if (lp_server_role() == ROLE_DOMAIN_MEMBER) - { #if 0 - lsa_lookup_sids(global_myworkgroup, gmep->sid, - gmep->nt_name, gmep->nt_domain...); + lsa_lookup_sids(global_myworkgroup, gmep->sid, + gmep->nt_name, gmep->nt_domain...); #endif - } + } - /* - * ok, it's one of ours. we therefore "create" an nt group or - * alias name named after the unix group. this is the point - * where "appliance mode" should get its teeth in, as unix - * groups won't really exist, they will only be numbers... - */ + /* + * ok, it's one of ours. we therefore "create" an nt group or + * alias name named after the unix group. this is the point + * where "appliance mode" should get its teeth in, as unix + * groups won't really exist, they will only be numbers... + */ - /* name is not explicitly mapped - * with map files or the PDC - * so we are responsible for it... - */ + /* name is not explicitly mapped + * with map files or the PDC + * so we are responsible for it... + */ + + if (lp_server_role() == ROLE_DOMAIN_MEMBER) + { + /* ... as a LOCAL group. */ + gmep->type = SID_NAME_ALIAS; + } + else + { + /* ... as a DOMAIN group. */ + gmep->type = SID_NAME_DOM_GRP; + } + + sid_copy(&gmep->sid, sid); + if (!surs_sam_sid_to_unixid(&gmep->sid, &id, False)) + { + return False; + } - if (lp_server_role() == ROLE_DOMAIN_MEMBER) + gmep->unix_id = id.id; + switch (id.type) + { + case SURS_POSIX_UID_AS_USR: { - /* ... as a LOCAL group. */ - gmep->type = SID_NAME_ALIAS; + gmep->type = SID_NAME_USER; + break; } - else + case SURS_POSIX_GID_AS_GRP: { - /* ... as a DOMAIN group. */ gmep->type = SID_NAME_DOM_GRP; + break; } - - sid_copy(&gmep->sid, sid); - if (!surs_sam_sid_to_unixid(&gmep->sid, &id, False)) - { - return False; - } - - gmep->unix_id = id.id; - switch (id.type) + case SURS_POSIX_GID_AS_ALS: { - case SURS_POSIX_UID_AS_USR: - { - gmep->type = SID_NAME_USER; - break; - } - case SURS_POSIX_GID_AS_GRP: - { - gmep->type = SID_NAME_DOM_GRP; - break; - } - case SURS_POSIX_GID_AS_ALS: - { - gmep->type = SID_NAME_ALIAS; - break; - } + gmep->type = SID_NAME_ALIAS; + break; } - - fstrcpy(gmep->nt_name, gidtoname((gid_t) gmep->unix_id)); - fstrcpy(gmep->unix_name, gmep->nt_name); - gmep->nt_domain = global_sam_name; - return True; } - /* oops */ - return False; + fstrcpy(gmep->nt_name, gidtoname((gid_t) gmep->unix_id)); + fstrcpy(gmep->unix_name, gmep->nt_name); + gmep->nt_domain = global_sam_name; + return True; } /************************************************************************* @@ -1201,6 +1178,10 @@ BOOL lookupsmbgrpsid(DOM_SID *sid, DOM_NAME_MAP * gmep) *************************************************************************/ BOOL lookupsmbgrpgid(gid_t gid, DOM_NAME_MAP * gmep) { + static fstring nt_name; + static fstring unix_name; + static fstring nt_domain; + DEBUG(10, ("lookupsmbgrpgid: unix gid %d\n", (int)gid)); if (map_alias_gid(gid, gmep)) { @@ -1210,55 +1191,46 @@ BOOL lookupsmbgrpgid(gid_t gid, DOM_NAME_MAP * gmep) { return True; } - if (lp_server_role() != ROLE_DOMAIN_NONE) + gmep->nt_name = nt_name; + gmep->unix_name = unix_name; + gmep->nt_domain = nt_domain; + gmep->unix_id = (uint32)gid; + /* + * here we should do a LsaLookupNames() call + * to check the status of the name with the PDC. + * if the PDC know nothing of the name, it's ours. + */ + if (lp_server_role() == ROLE_DOMAIN_MEMBER) { - static fstring nt_name; - static fstring unix_name; - static fstring nt_domain; - gmep->nt_name = nt_name; - gmep->unix_name = unix_name; - gmep->nt_domain = nt_domain; - gmep->unix_id = (uint32)gid; - /* - * here we should do a LsaLookupNames() call - * to check the status of the name with the PDC. - * if the PDC know nothing of the name, it's ours. - */ - if (lp_server_role() == ROLE_DOMAIN_MEMBER) - { - } + } - /* - * ok, it's one of ours. we therefore "create" an nt group or - * alias name named after the unix group. this is the point - * where "appliance mode" should get its teeth in, as unix - * groups won't really exist, they will only be numbers... - */ + /* + * ok, it's one of ours. we therefore "create" an nt group or + * alias name named after the unix group. this is the point + * where "appliance mode" should get its teeth in, as unix + * groups won't really exist, they will only be numbers... + */ - /* name is not explicitly mapped - * with map files or the PDC - * so we are responsible for it... - */ + /* name is not explicitly mapped + * with map files or the PDC + * so we are responsible for it... + */ - if (lp_server_role() == ROLE_DOMAIN_MEMBER) - { - /* ... as a LOCAL group. */ - gmep->type = SID_NAME_ALIAS; - } - else - { - /* ... as a DOMAIN group. */ - gmep->type = SID_NAME_DOM_GRP; - } - fstrcpy(gmep->nt_domain, global_sam_name); - fstrcpy(gmep->nt_name, gidtoname(gid)); - fstrcpy(gmep->unix_name, gmep->nt_name); - return get_sid_and_type(gmep->nt_domain, - gmep->nt_name, gmep->type, gmep); + if (lp_server_role() == ROLE_DOMAIN_MEMBER) + { + /* ... as a LOCAL group. */ + gmep->type = SID_NAME_ALIAS; } - - /* oops */ - return False; + else + { + /* ... as a DOMAIN group. */ + gmep->type = SID_NAME_DOM_GRP; + } + fstrcpy(gmep->nt_domain, global_sam_name); + fstrcpy(gmep->nt_name, gidtoname(gid)); + fstrcpy(gmep->unix_name, gmep->nt_name); + return get_sid_and_type(gmep->nt_domain, + gmep->nt_name, gmep->type, gmep); } |