Changeset - 0d9720a6c5b3
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-08-01 13:18:05

Replaced fopen() with stat() in login()
1 file changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/server/slavefuncs.c
Show inline comments
 
@@ -200,14 +200,18 @@ int login_user(char *username)
 

	
 
  strcpy(userhost, username);
 
  strcat(userhost, "@protofusion.org"); // Throws @protofusion.org after the username
 

	
 

	
 
  fprintf(stderr, "Logging you in to %s\n", userhost);
 
  if(fopen(SYSCONFDIR "distren.id_rsa", "r") == NULL){
 
	  fprintf(stderr,"Your key has not been found! Re-register or somehow regenerate your key!\nWe need a way to regenerate keys coded in, but we don't have the facilities yet!");
 

	
 
  int status;
 
  struct stat buffer;
 
  status = stat(SYSCONFDIR "/distren.id_rsa", &buffer);
 
  if(status != -1){
 
	  fprintf(stderr,"Your key has not been found! Re-register or somehow regenerate your key!\nWe need a way to regenerate keys coded in, but we don't have the facilities yet!\n");
 
	  return 0;
 
  }
 
  execio_open(&testrem, "ssh", execargv); // TODO: Grab returns from this someday
 
  buf[9] = '\0'; // null-terminating the array...
 
  while(!execio_read(testrem, buf, 9, &readlen))
 
    {
0 comments (0 inline, 0 general)