Changeset - 5f3193acd8ab
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-07-30 15:17:35

ssh-keygen crashes. ugh.
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/server/slavefuncs.c
Show inline comments
 
@@ -31,21 +31,23 @@
 
int ssh_keygen(){
 
	// distren.id_rsa and distren.id_rsa.pub are now generated in SYSCONFDIR (etc)
 
	char *command = "ssh-keygen"; // @TODO: append .exe if win32?
 
	char *path_to_command = "/usr/bin/ssh-keygen";
 
	int ret;
 
	char *cmd[] = { command, "-q", "-f", SYSCONFDIR "/distren.id_rsa", "-N", "", (char *)0 }; // TODO: Give me the correct args!
 
	/** We're crashing right at this next statement below! */
 
	ret = execv(path_to_command, cmd); // This path will be absolute for testing, should be relative to install on production
 
	if(ret == -1){
 
		fprintf(stderr, "Generating your key failed. Ensure that ssh-keygen is present!\n"); // Use different executor that searches the path? there is one...
 
		return 0;
 
	}
 
	else{
 
		fprintf(stderr,"We successfully generated your key! Yay!");
 
		return 1;
 
	}
 
	fprintf(stderr,"02");
 
return 0;
 
}
 

	
 
int register_user(char *username, char *email)
 
{
 
  /*
 
@@ -87,12 +89,13 @@ 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. */
 

	
 
  ssh_keygen(); // generates distren_rsa
 
  fprintf(stderr, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH");
 
  conf_replace(username); // puts the person's username in the conf
 
  /* @TODO: Scan distrenslave.conf for !username and !key and replace them with "keyname" and the "username" */
 
  return 1;
 
}
 

	
 

	
0 comments (0 inline, 0 general)