Changeset - ca71437158f0
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-08-01 13:20:40

Inverted detection of key
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/server/slavefuncs.c
Show inline comments
 
@@ -186,49 +186,49 @@ int login_user(char *username)
 
      "-p",
 
      "23",
 
      (char *)NULL,// username and hostname
 
      "echo",
 
      "hello", // This should eventually open a non-terminating connection to the server for communication,
 

	
 
      (char *)NULL
 
    };
 
  size_t readlen;
 

	
 
  /*< @TODO remove being tied to protofusion.org for no reason  */
 
  userhost = malloc(strlen(username) + strlen("@protofusion.org") + 1);
 
  if(!userhost)
 
    return 43;
 

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

	
 

	
 
  fprintf(stderr, "Logging you in to %s\n", userhost);
 

	
 
  int status;
 
  struct stat buffer;
 
  status = stat(SYSCONFDIR "/distren.id_rsa", &buffer);
 
  if(status != -1){
 
  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))
 
    {
 
      if(readlen > 9) {
 
	fprintf(stderr, "!!!! Something is terribly wrong!\n");
 
      }
 
    buf[readlen] = '\0';
 
    fprintf(stderr, "read \"%s\"\n", buf);
 
    }
 
  execio_close(testrem);
 
  return 1; // 1 can be like... error-free login...
 
}
 

	
 
/** Replaces username and key in the slave's conf file */
 
int conf_replace(char *username){
 
  /* Note: SYSCONFDIR doesn't include a trailing slash */
 
  int maxlinelen = 120;
 
  char *fileOrig = SYSCONFDIR "/distrenslave.conf";
 
  char *fileRepl = SYSCONFDIR "/distrenslave.conf.edited";
 
  char *text2find = "!username";
0 comments (0 inline, 0 general)