summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-07-24 20:02:48 +0000
committerSimo Sorce <idra@samba.org>2001-07-24 20:02:48 +0000
commit1cbae7315f99835ee294ce96858f73b5f8a18cfe (patch)
treed1c791f20d4e2b3246b3f53ed5dcc02956b3080d /source3/smbd
parent78dfa74852896dcc18513c1ba9a0dcaaf0c2a146 (diff)
downloadsamba-1cbae7315f99835ee294ce96858f73b5f8a18cfe.tar.gz
samba-1cbae7315f99835ee294ce96858f73b5f8a18cfe.tar.bz2
samba-1cbae7315f99835ee294ce96858f73b5f8a18cfe.zip
Convert other parameters (read list, write list, valid users...) to the P_LIST format.
changed functions to use list instead of strings addedd lp_list_substitute function (This used to be commit 7257d07563ba21bd88733d5d2b4ec4829fab2507)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/password.c35
-rw-r--r--source3/smbd/service.c29
2 files changed, 39 insertions, 25 deletions
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index fb9c39bde4..bc05d5f500 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -648,25 +648,34 @@ check if a username is valid
****************************************************************************/
BOOL user_ok(char *user,int snum)
{
- pstring valid, invalid;
+ char **valid, **invalid;
BOOL ret;
- StrnCpy(valid, lp_valid_users(snum), sizeof(pstring)-1);
- StrnCpy(invalid, lp_invalid_users(snum), sizeof(pstring)-1);
+ valid = invalid = NULL;
+ ret = True;
- pstring_sub(valid,"%S",lp_servicename(snum));
- pstring_sub(invalid,"%S",lp_servicename(snum));
-
- ret = !user_in_list(user,invalid);
-
- if (ret && valid && *valid) {
- ret = user_in_list(user,valid);
+ if (lp_invalid_users(snum)) {
+ lp_list_copy(&invalid, lp_invalid_users(snum));
+ if (invalid && lp_list_substitute(invalid, "%S", lp_servicename(snum))) {
+ ret = !user_in_list(user, invalid);
+ }
}
+ if (invalid) lp_list_free (&invalid);
+
+ if (ret && lp_valid_users(snum)) {
+ lp_list_copy(&valid, lp_valid_users(snum));
+ if (valid && lp_list_substitute(valid, "%S", lp_servicename(snum))) {
+ ret = user_in_list(user,valid);
+ }
+ }
+ if (valid) lp_list_free (&valid);
if (ret && lp_onlyuser(snum)) {
- char *user_list = lp_username(snum);
- pstring_sub(user_list,"%S",lp_servicename(snum));
- ret = user_in_list(user,user_list);
+ char **user_list = lp_list_make (lp_username(snum));
+ if (user_list && lp_list_substitute(user_list, "%S", lp_servicename(snum))) {
+ ret = user_in_list(user, user_list);
+ }
+ if (user_list) lp_list_free (&user_list);
}
return(ret);
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 2152a3e4df..b65ac13e74 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -337,18 +337,23 @@ connection_struct *make_connection(char *service,char *user,char *password, int
{
- pstring list;
- StrnCpy(list,lp_readlist(snum),sizeof(pstring)-1);
- pstring_sub(list,"%S",service);
+ char **list;
- if (user_in_list(user,list))
- conn->read_only = True;
-
- StrnCpy(list,lp_writelist(snum),sizeof(pstring)-1);
- pstring_sub(list,"%S",service);
-
- if (user_in_list(user,list))
- conn->read_only = False;
+ lp_list_copy(&list, lp_readlist(snum));
+ if(list && lp_list_substitute(list, "%S", service)) {
+ if (user_in_list(user, list))
+ conn->read_only = True;
+ }
+ else DEBUG(0, ("read list substitution failed readlist: 0x%x list: 0x%x\n", lp_readlist(snum), list));
+ if (list) lp_list_free(&list);
+
+ lp_list_copy(&list, lp_writelist(snum));
+ if(list && lp_list_substitute(list, "%S", service)) {
+ if (user_in_list(user, list))
+ conn->read_only = False;
+ }
+ else DEBUG(0, ("write list substitution failed writelist: 0x%x list: 0x%x\n", lp_writelist(snum), list));
+ if (list) lp_list_free(&list);
}
/* admin user check */
@@ -357,7 +362,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int
marked read_only. Changed as I don't think this is needed,
but old code left in case there is a problem here.
*/
- if (user_in_list(user,lp_admin_users(snum))
+ if (user_in_list(user, lp_admin_users(snum))
#if 0
&& !conn->read_only
#endif