Support This Project

Changeset 2023

Show
Ignore:
Timestamp:
08/14/08 18:52:18 (4 months ago)
Author:
virdiq
Message:

Fix incorrect assumptions in do_stor that GetGroupByID and GetUserByID always return valid structs.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libwzd-core/wzd_ClientThread.c

    r2022 r2023  
    22232223int do_stor(wzd_string_t *name, wzd_string_t *arg, wzd_context_t * context) 
    22242224{ 
    2225   char path[WZD_MAX_PATH],path2[WZD_MAX_PATH]; 
     2225  char path[WZD_MAX_PATH]; 
     2226  char path2[WZD_MAX_PATH]; 
    22262227  int fd; 
    22272228  u64_t bytesnow, byteslast; 
     
    22292230  int ret; 
    22302231  wzd_user_t * user; 
     2232  wzd_group_t * group; 
    22312233  const char *param; 
    22322234  connection_state_t restorestate; 
     
    22372239  user = GetUserByID(context->userid); 
    22382240 
    2239   if ( !(user->userperms & RIGHT_STOR) ) { 
     2241  if ( !user || (user && !(user->userperms & RIGHT_STOR)) ) { 
    22402242    ret = send_message_with_args(550,context,"STOR","No access"); 
    22412243    return E_NOPERM; 
     
    23492351  /* set owner */ 
    23502352  { 
    2351     const char *groupname=NULL; 
    23522353    if (user->group_num > 0) { 
    2353       groupname = GetGroupByID(user->groups[0])->groupname; 
    2354     } 
    2355     file_chown (path,user->username,groupname,context); 
     2354      group = GetGroupByID(user->groups[0]); 
     2355    } 
     2356    file_chown(path, 
     2357        user->username, 
     2358        group ? group->groupname : NULL, 
     2359        context 
     2360        ); 
    23562361  } 
    23572362