diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -90,6 +90,9 @@ struct general_info unsigned long total_priority_pieces; user_mgr_t user_mgr; + + /* my servertype, see protocol.h */ + uint8_t servertype; }; @@ -307,6 +310,8 @@ int distrend_handle_version(struct gener return 1; } + client->servertype = version.servertype; + return 0; } @@ -394,7 +399,8 @@ static distren_request_file_post_context */ void distrend_client_file_post_free(struct distrend_client_file_post *client_file_post) { - fclose(client_file_post->fd); + if(client_file_post->fd) + fclose(client_file_post->fd); free(client_file_post->filename); unlink(client_file_post->file_save_path); free(client_file_post->file_save_path); @@ -414,11 +420,6 @@ int distrend_handle_file_post_start(stru int ret; - /** - * @todo access check! - */ - fprintf(stderr, __FILE__ ":%d:distrend_handle_file_post_start(): You need to check if a client is actually allowed to upload files somehow!\n", __LINE__); - /* * other servers should be excluded from this check, but we don't * store the servertype in client yet. @@ -581,6 +582,8 @@ int distrend_handle_file_post_finish(str * Here it is... manage a file being submitted for rendering... or * for whatever purpose it was uploaded for somehow... */ + fclose(client_file_post->fd); + client_file_post->fd = NULL; distrend_handle_successful_upload(client, client_file_post); list_remove_element(client->file_post_list, client_file_post); @@ -599,6 +602,8 @@ int distrend_handle_successful_upload(st fprintf(stderr, __FILE__ ":%d: STUB: I don't know what to do with %s[%s] :-/\n", __LINE__, client_file_post->filename, client_file_post->file_save_path); + unpackJob("/home/ohnobinki/var/distren/tmp", client_file_post->file_save_path); + return 0; }