Changeset 165 for branches/samba-3.0/source/smbd/uid.c
- Timestamp:
- Mar 11, 2009, 9:14:55 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/smbd/uid.c
r106 r165 143 143 } 144 144 145 /******************************************************************* 146 Check if a username is OK in share level security. 147 ********************************************************************/ 148 149 static bool check_user_ok_sharelevel_security(connection_struct *conn, 150 const char *unix_name, 151 int snum) 152 { 153 NT_USER_TOKEN *token = conn->nt_user_token; 154 155 if (!user_ok_token(unix_name, token, snum)) { 156 return false; 157 } 158 159 conn->read_only = is_share_read_only_for_token(unix_name, 160 token, 161 snum); 162 163 if (!conn->read_only && 164 !share_access_check(token, lp_servicename(snum), 165 FILE_WRITE_DATA)) { 166 /* smb.conf allows r/w, but the security descriptor denies 167 * write. Fall back to looking at readonly. */ 168 conn->read_only = true; 169 DEBUG(5,("falling back to read-only access-evaluation due to " 170 "security descriptor\n")); 171 } 172 173 if (!share_access_check(token, lp_servicename(snum), 174 conn->read_only ? 175 FILE_READ_DATA : FILE_WRITE_DATA)) { 176 return false; 177 } 178 179 conn->admin_user = token_contains_name_in_list( 180 unix_name, NULL, token, 181 lp_admin_users(SNUM(conn))); 182 183 return true; 184 } 185 186 145 187 /**************************************************************************** 146 188 Become the user of a connection number without changing the security context … … 150 192 BOOL change_to_user(connection_struct *conn, uint16 vuid) 151 193 { 194 enum security_types sec = (enum security_types)lp_security(); 152 195 user_struct *vuser = get_valid_user_struct(vuid); 153 154 196 int snum; 155 197 gid_t gid; … … 173 215 */ 174 216 175 if(( lp_security()== SEC_SHARE) && (current_user.conn == conn) &&217 if((sec == SEC_SHARE) && (current_user.conn == conn) && 176 218 (current_user.ut.uid == conn->uid)) { 177 219 DEBUG(4,("change_to_user: Skipping user change - already " … … 194 236 lp_servicename(snum))); 195 237 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; 196 245 } 197 246 … … 273 322 DEBUG(5,("change_to_user uid=(%d,%d) gid=(%d,%d)\n", 274 323 (int)getuid(),(int)geteuid(),(int)getgid(),(int)getegid())); 275 324 276 325 return(True); 277 326 }
Note:
See TracChangeset
for help on using the changeset viewer.