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
 
@@ -32,14 +32,15 @@
 

	
 
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),
 
@@ -59,6 +60,7 @@ int main(int argc, char *argv[])
 
  datadir = NULL;
 
  server = NULL;
 
  username = NULL;
 
  password = NULL;
 

	
 
  char curopt;
 

	
 
@@ -99,6 +101,11 @@ int main(int argc, char *argv[])
 
  /* 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");
src/server/slavefuncs.c
Show inline comments
 
@@ -469,10 +469,12 @@ void prepareJobPaths(int jobnum, int fra
 
   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 )
0 comments (0 inline, 0 general)