Changeset - f0c5242da315
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-04-30 16:12:44

Fixed it... left a bracket :)
1 file changed with 0 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/client/distren.c
Show inline comments
 
@@ -55,61 +55,60 @@ int main(int argc, char *argv[])
 
  int i;
 

	
 
  i = 1;
 

	
 
  if(options_init(argc, argv, &cfg, cfg_opts, "client", &options))
 
    {
 
      fprintf(stderr, "error getting configuration\n");
 
      return 1;
 
    }
 

	
 

	
 
  // Please find a better way of doing this :( you can't strcat multiple strings.. meh
 
  // use something like sprintf
 
  //char *username = cfg_getstr(cfg, "username");
 
  //char *hostname = cfg_getstr(cfg, "hostname");
 
  //strcat(username, "@");
 
  //strcat(username, hostname);
 

	
 

	
 
  // SSH's to client machine with the username speficied.
 
    char buf[10];
 
    struct execio *testrem;
 
    char *execargv[] =
 
      {
 
	"ssh",
 
	"username", //cfg_getstr(cfg, "username") . "@" . cfg_getstr(cfg, "hostname"),
 
	"-i guest.rsa", //yeaaaah any better ideas?
 
	"sh",
 
	"-c",
 
	"\"echo hello from ${HOSTNAME}\"", // "\"useradd -M -c" strcat( cfg_getstr(cfg, "name") cfg_getstr(cfg, "email")) "-d /home/distren --gid 537" cfg_getstr(cfg, "username") "\"",
 
	(char *)NULL
 
      };
 

	
 
    size_t readlen;
 
    fprintf(stderr, "execio madness is occuring!");
 
    fprintf(stderr, "execio_open returns %d\n", execio_open(&testrem, "ssh", execargv));
 
    buf[9] = '\0';
 
    while(!execio_read(testrem, buf, 9, &readlen))
 
      {
 
	if(readlen > 9)
 
	  {
 
	    fprintf(stderr, "execio_read doesn't set readlen correctly or read() is messed up\n");
 
	    return 1;
 
	  }
 
	buf[readlen] = '\0';
 
	fprintf(stderr, "read \"%s\"\n", buf);
 
      }
 
    execio_close(testrem);
 
  }
 
  // Can we prune off some of this code up here^? I'm not exactly sure how execio returns output, but it seems like more could be happening in execio itself, and less happening where it is actually called.
 
  // We need some code to ssh, and if the SSH fails, tell the user to register.
 
  // Killed the user reg code, as the php interface will take care of this. Although it should check for users...
 

	
 
  options_free(options);
 
  return 0;
 
};
 

	
 

	
 

	
 

	
 

	
0 comments (0 inline, 0 general)