diff --git a/src/server/slavefuncs.c b/src/server/slavefuncs.c --- a/src/server/slavefuncs.c +++ b/src/server/slavefuncs.c @@ -63,6 +63,11 @@ xmlNodePtr xml_quickxpath(xmlXPathContex } +/** Stub for deleting job data from the disk. @TODO: unstubify me! */ +int delete_jobdata(int jobnum){ + return 0; +} + /** Stub stub stubbiness ugh @TODO: Kill me. */ void tell_the_server(char *stuff){ } @@ -94,7 +99,7 @@ int curlget(char *url, char *out){ /** Posts a file to a url with cUrl */ int curlpost(char *filename, char *url){ - char *targetname = "uploadedfile"; // Name of the target in the php file + char *targetname = "uploadedfile"; // Name of the target in the php file on the server (Don't change me unless you have different PHP code) CURL *curl; CURLcode res; struct curl_httppost *formpost=NULL; @@ -116,7 +121,7 @@ int curlpost(char *filename, char *url){ CURLFORM_COPYNAME, "filename", CURLFORM_COPYCONTENTS, filename, CURLFORM_END); - /* submit field, not usually needed, just in case */ + /* submit field, not usually needed, just in case... */ curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "submit", @@ -157,8 +162,8 @@ int ssh_keygen(){ char buf[10]; struct execio *testrem; size_t readlen; - ret = execio_open(&testrem, command, cmd); // This path will be absolute for testing, should be relative to install on production - buf[9] = '\0'; // null-terminating the array... + ret = execio_open(&testrem, command, cmd); // @TODO: This path will be absolute for testing, should be relative to install on production + buf[9] = '\0'; while(!execio_read(testrem, buf, 9, &readlen)) { if(readlen > 9) { @@ -203,6 +208,7 @@ int register_user(char *username, char * * All created user accounts should be sandboxed accordingly, requiring a different skel, and the default shell to be rbash. Also, * a custom path defined in the .bashrc of the skel is needed. */ + int ret; char buf[10]; struct execio *testrem; char *execargv[] = @@ -225,7 +231,7 @@ int register_user(char *username, char * (char *)NULL }; size_t readlen; - execio_open(&testrem, "ssh", execargv); // TODO: Grab returns from this someday. + ret = execio_open(&testrem, "ssh", execargv); // TODO: Grab returns from this someday. buf[9] = '\0'; while(!execio_read(testrem, buf, 9, &readlen)) { @@ -238,8 +244,16 @@ int register_user(char *username, char * execio_close(testrem); /* @TODO: Parse the output buffer or something to check when user creation fails due to duplicate users. This is pretty important. */ + if(ret == 1){ + fprintf(stderr, "Unable to log you in. Ensure that ssh is present on your system.\n"); // Use different executor that searches the path? there is one... + return 0; + } + else{ + fprintf(stderr,"Logged in successfully!\n"); + return 1; + } - return 1; // 1 is success + return 0; // 0 is fai } /** Logs the user into the server after ensuring that keys exist */