Ignore:
Timestamp:
May 26, 2009, 9:44:50 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.2.x/source/smbd/uid.c

    r133 r228  
    103103        readonly_share = is_share_read_only_for_token(vuser->user.unix_name,
    104104                                                      vuser->nt_user_token,
    105                                                       SNUM(conn));
     105                                                      conn);
    106106
    107107        token = conn->nt_user_token ?
     
    141141        return(True);
    142142}
     143
     144/*******************************************************************
     145 Check if a username is OK in share level security.
     146********************************************************************/
     147
     148static bool check_user_ok_sharelevel_security(connection_struct *conn,
     149                                        const char *unix_name,
     150                                        int snum)
     151{
     152        NT_USER_TOKEN *token = conn->nt_user_token;
     153
     154        if (!user_ok_token(unix_name, token, snum)) {
     155                return false;
     156        }
     157
     158        conn->read_only = is_share_read_only_for_token(unix_name,
     159                                                      token,
     160                                                      conn);
     161
     162        if (!conn->read_only &&
     163            !share_access_check(token, lp_servicename(snum),
     164                                FILE_WRITE_DATA)) {
     165                /* smb.conf allows r/w, but the security descriptor denies
     166                 * write. Fall back to looking at readonly. */
     167                conn->read_only = true;
     168                DEBUG(5,("falling back to read-only access-evaluation due to "
     169                         "security descriptor\n"));
     170        }
     171
     172        if (!share_access_check(token, lp_servicename(snum),
     173                                conn->read_only ?
     174                                FILE_READ_DATA : FILE_WRITE_DATA)) {
     175                return false;
     176        }
     177
     178        conn->admin_user = token_contains_name_in_list(
     179                                unix_name, NULL, token,
     180                                lp_admin_users(SNUM(conn)));
     181
     182        return true;
     183}
     184
    143185
    144186/****************************************************************************
     
    173215         */
    174216
    175         if((lp_security() == SEC_SHARE) && (current_user.conn == conn) &&
     217        if((sec == SEC_SHARE) && (current_user.conn == conn) &&
    176218           (current_user.ut.uid == conn->uid)) {
    177219                DEBUG(4,("change_to_user: Skipping user change - already "
     
    194236                         lp_servicename(snum)));
    195237                return False;
     238        } else if ((sec == SEC_SHARE) && !check_user_ok_sharelevel_security(conn,
     239                        conn->user, snum)) {
     240                DEBUG(2,("change_to_user: unix user %s "
     241                         "not permitted access to share %s.\n",
     242                         conn->user,
     243                         lp_servicename(snum)));
     244                return false;
    196245        }
    197246
Note: See TracChangeset for help on using the changeset viewer.