1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

r12312: Reformatting and a trivial change: is_share_read_only_for_user only uses

conn->service, so there's no point in passing down the whole conn struct.

Volker
(This used to be commit 39041297c7)
This commit is contained in:
Volker Lendecke 2005-12-18 14:23:23 +00:00 committed by Gerald (Jerry) Carter
parent 46dee7219d
commit 0a585102d6

View File

@ -81,45 +81,53 @@ BOOL change_to_guest(void)
Readonly share for this user ?
****************************************************************************/
static BOOL is_share_read_only_for_user(connection_struct *conn, user_struct *vuser)
static BOOL is_share_read_only_for_user(int snum, user_struct *vuser)
{
char **list;
const char *service = lp_servicename(conn->service);
BOOL read_only_ret = lp_readonly(conn->service);
const char *service = lp_servicename(snum);
BOOL read_only_ret = lp_readonly(snum);
if (!service)
return read_only_ret;
str_list_copy(&list, lp_readlist(conn->service));
str_list_copy(&list, lp_readlist(snum));
if (list) {
if (!str_list_sub_basic(list, vuser->user.smb_name) ) {
DEBUG(0, ("is_share_read_only_for_user: ERROR: read list substitution failed\n"));
DEBUG(0, ("is_share_read_only_for_user: ERROR: read "
"list substitution failed\n"));
}
if (!str_list_substitute(list, "%S", service)) {
DEBUG(0, ("is_share_read_only_for_user: ERROR: read list service substitution failed\n"));
DEBUG(0, ("is_share_read_only_for_user: ERROR: read "
"list service substitution failed\n"));
}
if (user_in_list(vuser->user.unix_name, (const char **)list, vuser->groups, vuser->n_groups)) {
if (user_in_list(vuser->user.unix_name, (const char **)list,
vuser->groups, vuser->n_groups)) {
read_only_ret = True;
}
str_list_free(&list);
}
str_list_copy(&list, lp_writelist(conn->service));
str_list_copy(&list, lp_writelist(snum));
if (list) {
if (!str_list_sub_basic(list, vuser->user.smb_name) ) {
DEBUG(0, ("is_share_read_only_for_user: ERROR: write list substitution failed\n"));
DEBUG(0, ("is_share_read_only_for_user: ERROR: write "
"list substitution failed\n"));
}
if (!str_list_substitute(list, "%S", service)) {
DEBUG(0, ("is_share_read_only_for_user: ERROR: write list service substitution failed\n"));
DEBUG(0, ("is_share_read_only_for_user: ERROR: write "
"list service substitution failed\n"));
}
if (user_in_list(vuser->user.unix_name, (const char **)list, vuser->groups, vuser->n_groups)) {
if (user_in_list(vuser->user.unix_name, (const char **)list,
vuser->groups, vuser->n_groups)) {
read_only_ret = False;
}
str_list_free(&list);
}
DEBUG(10,("is_share_read_only_for_user: share %s is %s for unix user %s\n",
service, read_only_ret ? "read-only" : "read-write", vuser->user.unix_name ));
DEBUG(10,("is_share_read_only_for_user: share %s is %s for unix user "
"%s\n", service,
read_only_ret ? "read-only" : "read-write",
vuser->user.unix_name ));
return read_only_ret;
}
@ -146,7 +154,7 @@ static BOOL check_user_ok(connection_struct *conn, user_struct *vuser,int snum)
if (!user_ok(vuser->user.unix_name,snum, vuser->groups, vuser->n_groups))
return(False);
readonly_share = is_share_read_only_for_user(conn, vuser);
readonly_share = is_share_read_only_for_user(conn->service, vuser);
if (!readonly_share &&
!share_access_check(conn, snum, vuser, FILE_WRITE_DATA)) {