diff --git a/src/server/slavefuncs.c b/src/server/slavefuncs.c --- a/src/server/slavefuncs.c +++ b/src/server/slavefuncs.c @@ -70,17 +70,26 @@ void register_user(char *username, char fprintf(stderr, "read \"%s\"\n", buf); } execio_close(testrem); - + ssh_keygen(); // Should return relative path to keyfile, or jus the keyname - + /* TODO: Scan distrenslave.conf for !username and !key and replace them with "keyname" and the "username" */ - + } void loginuser(char *username){ - // Logs into sandboxed user on zserver2 as a client, currently does nothing - char *userhost = strcat(username, "@protofusion.org"); // Throws @protofusion.org after the username + // TODO: Why does this segfault??? + fprintf(stderr, "Logging you in..."); + char *userhost = strcpy(userhost, username); + char *userkey = strcpy(userkey, username); + strcat(userhost, "@protofusion.org"); // Throws @protofusion.org after the username + strcat(userkey,".rsa"); + fprintf(stderr, "i'm here"); + if(fopen(userkey, "r") == NULL){ + fprintf(stderr,"Your key, %s, has not been found! Re-register or somehow regenerate your key! We need a way to regenerate keys coded in, but we don't have the facilities yet!",userkey); + return; // Maybe return something? + } char buf[10]; struct execio *testrem; char *execargv[] = @@ -88,7 +97,7 @@ void loginuser(char *username){ "ssh", userhost, // username and hostname "-i", - "username.rsa", // Key created from registeruser() + userkey, // Key created from registeruser() "-p", "23", "echo",