Changeset - 7d056f57c29a
[Not reviewed]
default
0 2 0
Nathan Brink (binki) - 16 years ago 2010-03-13 22:48:14
ohnobinki@ohnopublishing.net
add password to distrenslave.conf parser, fix checkUsername()
2 files changed with 14 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/server/simpleslave.c
Show inline comments
 
@@ -29,20 +29,21 @@
 
#include <sys/stat.h>
 
#include <unistd.h>
 

	
 

	
 
int main(int argc, char *argv[])
 
{
 

	
 
  char *datadir;
 
  char *server;
 
  char *username;
 
  char *password; // @TODO: Binki: fill me with confiness
 
  char *password;
 
  char *hostname;
 

	
 
  cfg_opt_t myopts[] = {
 
    CFG_SIMPLE_STR("username", &username),
 
    CFG_SIMPLE_STR("password", &password),
 
    CFG_SIMPLE_STR("datadir", &datadir),
 
    CFG_SIMPLE_STR("server", &server),
 
    CFG_SIMPLE_STR("hostname", &hostname),
 
    CFG_END()
 
  };
 
  cfg_t * my_cfg;
 
@@ -56,12 +57,13 @@ int main(int argc, char *argv[])
 
  /**
 
     initializations
 
  */
 
  datadir = NULL;
 
  server = NULL;
 
  username = NULL;
 
  password = NULL;
 

	
 
  char curopt;
 

	
 
  while(((char)-1) != (curopt = getopt(argc, argv, "u:th")))
 
     {
 
       if(curopt == ':')
 
@@ -96,12 +98,17 @@ int main(int argc, char *argv[])
 
  options_init(argc, argv, &my_cfg, myopts, "slave", &commonopts);
 

	
 

	
 
  /* Notifies the user if there no username in .conf */
 
  if(checkUsername(username))
 
    return 1;
 
  if(!password)
 
    {
 
      fprintf(stderr, "You haven't specified a password. Please edit your distrenslave.conf file appropriately\n");
 
      return 1;
 
    }
 

	
 
  /*
 
  fprintf(stderr, "Connecting to server...\n");
 
  if(remoteio_open(&comm_slave, commonopts->remoteio, server))
 
    {
 
      fprintf(stderr, "Error connecting to server; exiting\n");
src/server/slavefuncs.c
Show inline comments
 
@@ -466,16 +466,18 @@ void prepareJobPaths(int jobnum, int fra
 
   _distren_asprintf(pathtoJobfile, "%s/%s/job.blend", datadir, jobdatapath ); // Prepares the path to the jobfile
 
   _distren_asprintf(urltoOutput, "http://distren.org/slaveUpload.php"); // Prepares the URL where output is posted
 
   _distren_asprintf(pathtoOutput, "%s/job%d/output/job%d-frame%d.%s", datadir, jobnum, jobnum, framenum, outputExt );
 
   free(jobdatapath);
 
}
 

	
 
int checkUsername(char *username){
 
  if(username == NULL || strcmp(username, "!username") == 0 ) {
 
int checkUsername(char *username)
 
{
 
  if(username == NULL || strcmp(username, "!username") == 0 )
 
    {
 
     fprintf(stderr, "\nPlease ensure that your username is present in distrenslave.conf\n");
 
     return 0;
 
     return 1;
 
   }
 
   else
 
     if( username != NULL || strcmp(username, "!username") != 0 )
 
       {
 
         // Log in the user
 
         if(login_user(username) == 1){
0 comments (0 inline, 0 general)