Changeset - 52c827d07407
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-07-31 19:37:38

Added return check for conf_replace
1 file changed with 4 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/server/slavefuncs.c
Show inline comments
 
@@ -100,50 +100,52 @@ int register_user(char *username, char *
 
      "-c",
 
      email,
 
      "-d",
 
      "/home/distren",
 
      "--gid",
 
      "541",
 
      username,
 
      (char *)NULL
 
    };
 
  size_t readlen;
 
  fprintf(stderr, "Opening stream:\n", execio_open(&testrem, "ssh", execargv));
 
  buf[9] = '\0'; // null-terminating the array...
 
  while(!execio_read(testrem, buf, 9, &readlen))
 
    {
 
      if(readlen > 9) {
 
	fprintf(stderr, "!!!! Something is terribly wrong!\n");
 
      }
 
      buf[readlen] = '\0';
 
      fprintf(stderr, "read \"%s\"\n", buf);
 
    }
 
  execio_close(testrem);
 

	
 
  /* @TODO: Parse the output buffer or something to check when user creation fails due to duplicate users. This is pretty important. */
 

	
 

	
 
  conf_replace(username); // puts the person's username in the conf
 
  // puts the person's username in the conf
 
  if(conf_replace(username) == 0){
 
	  fprintf(stderr, "Failed!\n");
 
  }
 
  ssh_keygen(); // generates keys for login, @TODO: pub key must somehow be sent to the server.
 

	
 
  return 1;
 
}
 

	
 
/** Logs the user into the server with a nice ssh session */
 
int login_user(char *username)
 
{
 
  char *userhost;
 
  char *userkey;
 
  char buf[10];
 
  struct execio *testrem;
 
  char *execargv[] =
 
    {
 
      "ssh",
 

	
 
      "-i",
 
      (char *)NULL, // Key created from registeruser()
 
      "-p",
 
      "23",
 
      (char *)NULL,// username and hostname
 
      "echo",
 
      "hello", // This should eventually open a non-terminating connection to the server for communication,
 

	
0 comments (0 inline, 0 general)