diff options
author | Andrew Bartlett <abartlet@samba.org> | 2002-05-18 05:52:52 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2002-05-18 05:52:52 +0000 |
commit | 58e1fe62cc955c6b8449332447a6879c6fab64e7 (patch) | |
tree | d132d46aad501e052c6431a0506fbd7c0d56722b /source3/lib | |
parent | 27ecfceae15ae80224f4dedd07381598b945359e (diff) | |
download | samba-58e1fe62cc955c6b8449332447a6879c6fab64e7.tar.gz samba-58e1fe62cc955c6b8449332447a6879c6fab64e7.tar.bz2 samba-58e1fe62cc955c6b8449332447a6879c6fab64e7.zip |
A few things in this commit:
cleanup some of the code in net_rpc_join re const warnings and
fstrings.
Passdb:
Make the %u and %U substituions in passdb work.
This is done by declaring these paramters to be 'const' and doing
the substitution manually. I'm told this is us going full circle,
but I can't really see a better way.
Finally these things actually seem to work properly...
Make the lanman code use the pdb's recorded values for homedir etc
rather than the values from lp_*()
Add code to set the plaintext password in the passdb, where it can
decide how to store/set it. For use with a future 'ldap password
change' option, or somthing like that...
Add pdb_unix, so as to remove the 'not in passdb' special cases from the
local_lookup_*() code. Quite small, as it uses the new 'struct passwd ->
SAM_ACCOUNT' code that is now in just one place. (also used by pdb_smbpasswd)
Other:
Fix up the adding of [homes] at session setup time to actually pass
the right string, that is the unix homedir, not the UNC path.
Fix up [homes] so that for winbind users is picks the correct name.
(bad interactions with the default domain code previously)
Change the rpc_server/srv_lsa_nt.c code to match NT when for the
SATUS_NONE_MAPPED reply: This was only being triggered on
no queries, now it is on the 'no mappings' (ie all mappings failed).
Checked against Win2k.
Policy Question: Should SID -> unix_user.234/unix_group.364 be
considered a mapping or not? Currently it isn't.
Andrew Bartlett
(This used to be commit c28668068b5a3b3cf3c4317e5fb32ec9957f3e34)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/substitute.c | 52 | ||||
-rw-r--r-- | source3/lib/util_getent.c | 30 |
2 files changed, 69 insertions, 13 deletions
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index e878ee8cbf..09921c145d 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -279,6 +279,58 @@ void standard_sub_advanced(int snum, const char *user, const char *connectpath, standard_sub_basic(smb_name, str); } +const char *standard_sub_specified(TALLOC_CTX *mem_ctx, const char *input_string, + const char *username, + const char *domain, + uid_t uid, + gid_t gid) +{ + pstring input_pstring; + char *p, *s; + + pstrcpy(input_pstring, input_string); + + for (s=input_pstring; (p=strchr_m(s, '%')); s=p) { + + int l = sizeof(pstring) - (int)(p-input_pstring); + + switch (*(p+1)) { + case 'U' : + string_sub(p,"%U",username,l); + break; + case 'u' : + string_sub(p,"%u",username,l); + break; + case 'G' : + case 'g' : + if (gid != -1) { + string_sub(p,"%G",gidtoname(gid),l); + string_sub(p,"%g",gidtoname(gid),l); + } else { + string_sub(p,"%G","NO_GROUP",l); + string_sub(p,"%g","NO_GROUP",l); + } + break; + case 'D' : + string_sub(p,"%D", domain,l); + break; + case 'N' : + string_sub(p,"%N", automount_server(username),l); + break; + case '\0': + p++; + break; /* don't run off the end of the string */ + + default: p+=2; + break; + } + } + + standard_sub_basic(username, input_pstring); + + return talloc_strdup(mem_ctx, input_pstring); +} + /**************************************************************************** Do some standard substitutions in a string. ****************************************************************************/ diff --git a/source3/lib/util_getent.c b/source3/lib/util_getent.c index 02e4b932de..2e76121aae 100644 --- a/source3/lib/util_getent.c +++ b/source3/lib/util_getent.c @@ -277,20 +277,24 @@ struct sys_userlist *get_users_in_group(const char *gname) DOM_SID sid; enum SID_NAME_USE name_type; - (void) split_domain_and_name(gname, domain, groupname); - - /* - * If we're doing this via winbindd, don't do the - * entire group list enumeration as we know this is - * pointless (and slow). - */ - - if (winbind_lookup_name(domain, groupname, &sid, &name_type) && name_type == SID_NAME_DOM_GRP) { - if ((gptr = (struct group *)getgrnam(gname)) == NULL) - return NULL; - return add_members_to_userlist(list_head, gptr); + /* No point using winbind if we can't split it in the + first place */ + if (split_domain_and_name(gname, domain, groupname)) { + + /* + * If we're doing this via winbindd, don't do the + * entire group list enumeration as we know this is + * pointless (and slow). + */ + + if (winbind_lookup_name(domain, groupname, &sid, &name_type) + && name_type == SID_NAME_DOM_GRP) { + if ((gptr = (struct group *)getgrnam(gname)) == NULL) + return NULL; + return add_members_to_userlist(list_head, gptr); + } } - + setgrent(); while((gptr = getgrent()) != NULL) { if (strequal(gname, gptr->gr_name)) { |