Changeset - 4e24c5b3210e
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-07-28 00:50:20

Loginuser issues... meh
1 file changed with 15 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/server/slavefuncs.c
Show inline comments
 
@@ -67,31 +67,40 @@ void register_user(char *username, char 
 
	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);
 
  
 

	
 
  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[] =
 
    {
 
  "ssh",
 
  userhost, // username and hostname
 
  "-i",
 
  "username.rsa", // Key created from registeruser()
 
  userkey, // Key created from registeruser()
 
  "-p",
 
  "23",
 
  "echo",
 
  "hello", // This should eventually open a non-terminating connection to the server for communication
 
  (char *)NULL
 
  };
0 comments (0 inline, 0 general)