# HG changeset patch # User ethanzonca@localhost.localdomain # Date 2009-07-01 12:19:40 # Node ID d3ee86d58ec1f4b4e97948c1365facfc1c1c0c21 # Parent 4e98a910ab598d2e3fa72ff98ad1f434994d0e83 added some registration stuff diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -29,6 +29,7 @@ #include #include "execio.h" #include "options.h" +#include #define max 100 // maximum number of stored jobs in memory, per job type (lux/blend). Eventually we can dump this data to disk, or atleast the remainder not in memory... @@ -59,6 +60,73 @@ struct { int main(int argc, char *argv[]) { + + + +// We need the conf parser code from options.c here!!! + + +char *username = "unregistered"; +int registered; +if(username == "unregistered") { + registered = 0; +} + + + + + +// Registration on server. Needs attention. (e.g., people could make tons of accounts with the key we give them... +if(registered==0) { +char newusername[100]; + + fprintf(stderr, "Please enter your desired username: "); + fgets(newusername,100,stdin); + fprintf(stderr, "\nChecking availibility of username: %s\n\n",newusername); + // Mostly kinda copied from old code, but I understand it a tad better now :) + // Logs into sandboxed user on zserver2 and registers a user + char buf[10]; + struct execio *testrem; + char *execargv[] = + { + "ssh", + "distren_setup@protofusion.org", + "-i", + "setup.rsa", + "-p", + "23", + "sh", + "-c", + "sudo /usr/sbin/useradd", + "-M", + "-c", + "email", + "-d", + "/home/distren", + "--gid 537", + newusername, + (char *)NULL + }; + size_t readlen; + fprintf(stderr, "execio_open:", execio_open(&testrem, "ssh", execargv)); + buf[9] = '\0'; // null-terminating the array... + while(!execio_read(testrem, buf, 9, &readlen)) // What's with the readlen stuff? + { + if(readlen > 9) { + fprintf(stderr, "Something is terribly wrong!\n"); + } + buf[readlen] = '\0'; // Null-terminating the end of it again based on how large the data is? + fprintf(stderr, "read \"%s\"\n", buf); + } + execio_close(testrem); + + } +else{ + // Login with credentials +} + + + /* frame[frame] Assignments: "0" - cancelled @@ -97,30 +165,14 @@ void queue(int type, char *name, char *s jobnum++; } -// Mostly kinda copied from old code, but I understand it a tad better now :) -char buf[10]; -struct execio *testrem; -char *execargv[] = - { -"ssh", -"ethanzonca@protofusion.org", -"sh", -"-c", -"\"echo hello from ${HOSTNAME}\"", -(char *)NULL - }; -size_t readlen; -fprintf(stderr, "execio_open:", execio_open(&testrem, "ssh", execargv)); -buf[9] = '\0'; // null-terminating the array... -while(!execio_read(testrem, buf, 9, &readlen)) // What's with the readlen stuff? - { - if(readlen > 9) { - fprintf(stderr, "Something is terribly wrong!\n"); - } - buf[readlen] = '\0'; // Null-terminating the end of it again based on how large the data is? - fprintf(stderr, "read \"%s\"\n", buf); - } -execio_close(testrem); + + + + + + + + ///////////////////////// SLAVE ///////////////////////////////