Support This Project

Changeset 2015

Show
Ignore:
Timestamp:
07/25/08 17:28:09 (4 months ago)
Author:
virdiq
Message:

Backport r2013 for 0.8.4: Escape event arguments with quotation marks to allow spaces in arguments. Event arguments can no longer contain quotation marks.

Files:

Legend:

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

    r1912 r2015  
    266266 
    267267    if (user) { 
    268       event_args = STR(user->username); 
     268      event_args = str_allocate(); 
     269      str_sprintf(event_args, "\"%s\"", user->username); 
    269270      event_send(mainConfig->event_mgr, EVENT_LOGOUT, 0, event_args, context); 
    270271      str_deallocate(event_args); 
     
    345346      { 
    346347        wzd_string_t * event_args = str_allocate(); 
    347         str_sprintf(event_args,"%s %s",user->username,context->current_action.arg); 
    348         event_send(mainConfig->event_mgr, EVENT_POSTUPLOAD, 0, event_args, context); 
     348        str_sprintf(event_args, "\"%s\" \"%s\"", user->username, context->current_action.arg); 
     349       event_send(mainConfig->event_mgr, EVENT_POSTUPLOAD, 0, event_args, context); 
    349350        str_deallocate(event_args); 
    350351      } 
     
    12971298  { 
    12981299    wzd_string_t * event_args = str_allocate(); 
    1299     str_sprintf(event_args,"%s %s",user->username,buffer); 
     1300    str_sprintf(event_args, "\"%s\" \"%s\"", user->username, buffer); 
    13001301    ret = event_send(mainConfig->event_mgr, EVENT_PREMKDIR, 0, event_args, context); 
    13011302    str_deallocate(event_args); 
     
    13811382    send_message_raw("257- Command okay\r\n",context); 
    13821383    { 
    1383       wzd_string_t * event_args = STR(buffer); 
     1384      wzd_string_t * event_args = str_allocate(); 
     1385      str_sprintf(event_args, "\"%s\" \"%s\"", user->username, buffer); 
    13841386      event_send(mainConfig->event_mgr, EVENT_MKDIR, 257, event_args, context); 
    13851387      str_deallocate(event_args); 
     
    14751477    { 
    14761478      wzd_string_t * event_args = str_allocate(); 
    1477       str_sprintf(event_args,"%s %s",user->username,path); 
     1479      str_sprintf(event_args, "\"%s\" \"%s\"", user->username, path); 
    14781480      event_send(mainConfig->event_mgr, EVENT_RMDIR, 258, event_args, context); 
    14791481      str_deallocate(event_args); 
     
    20722074  { 
    20732075    wzd_string_t * event_args = str_allocate(); 
    2074     str_sprintf(event_args,"%s %s",user->username,path); 
     2076    str_sprintf(event_args, "\"%s\" \"%s\"", user->username, path); 
    20752077    ret = event_send(mainConfig->event_mgr, EVENT_PREDOWNLOAD, 0, event_args, context); 
    20762078    str_deallocate(event_args); 
     
    22792281  { 
    22802282    wzd_string_t * event_args = str_allocate(); 
    2281     str_sprintf(event_args,"%s %s",user->username,path); 
     2283    str_sprintf(event_args, "\"%s\" \"%s\"", user->username, path); 
    22822284    ret = event_send(mainConfig->event_mgr, EVENT_PREUPLOAD, 0, event_args, context); 
    22832285    str_deallocate(event_args); 
     
    27372739  if (!ret) { 
    27382740    { 
    2739       wzd_string_t * event_args = STR(path); 
     2741      wzd_string_t * event_args = str_allocate(); 
     2742      str_sprintf(event_args, "\"%s\" \"%s\"", user->username, path); 
    27402743      event_send(mainConfig->event_mgr, EVENT_DELE, 250, event_args, context); 
    27412744      str_deallocate(event_args); 
     
    33063309  send_message_raw("230- Command okay\r\n",context); 
    33073310  { 
    3308     wzd_string_t * event_args = STR(user->username); 
     3311    wzd_string_t * event_args = str_allocate(); 
     3312    str_sprintf(event_args, "\"%s\"", user->username); 
    33093313    event_send(mainConfig->event_mgr, EVENT_LOGIN, 230, event_args, context); 
    33103314    str_deallocate(event_args); 
  • branches/0.8/libwzd-core/wzd_data.c

    r1842 r2015  
    134134 
    135135    /** \todo Find a way to indicate if transfer was ok in event */ 
    136     str_sprintf(event_args,"%s %s",user->username,context->current_action.arg); 
     136    str_sprintf(event_args, "\"%s\" \"%s\"", user->username, context->current_action.arg); 
    137137    event_send(mainConfig->event_mgr, event_id, reply_code, event_args, context); 
    138138    str_deallocate(event_args); 
  • branches/0.8/libwzd-core/wzd_site.c

    r2001 r2015  
    22452245      wzd_string_t * event_args = str_allocate(); 
    22462246      wzd_user_t * user = GetUserByID(context->userid); 
    2247       str_sprintf(event_args,"%s %s",user->username,str_tochar(filename)); 
     2247      str_sprintf(event_args, "\"%s\" \"%s\"", user->username, str_tochar(filename)); 
    22482248      ret = event_send(mainConfig->event_mgr, EVENT_PREWIPE, 0, event_args, context); 
    22492249      str_deallocate(event_args); 
     
    22672267      wzd_string_t * event_args = str_allocate(); 
    22682268      wzd_user_t * user = GetUserByID(context->userid); 
    2269       str_sprintf(event_args,"%s %s",user->username,str_tochar(filename)); 
     2269      str_sprintf(event_args, "\"%s\" \"%s\"", user->username, str_tochar(filename)); 
    22702270      event_send(mainConfig->event_mgr, EVENT_WIPE, 200, event_args, context); 
    22712271      str_deallocate(event_args);