IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5265


Ignore:
Timestamp:
Oct 10, 2005, 8:47:34 PM (21 years ago)
Author:
eugene
Message:

added support for password/hostname for client/server

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/src/ConfigInit.c

    r5229 r5265  
    5656  ScanConfig (config, "SUBPIX_DATAFILE",        "%s",  0, SubpixDatafile);
    5757
     58  /* used by client/server setup */
     59  ScanConfig (config, "PASSWORD",               "%s",  0, PASSWORD);
     60  ScanConfig (config, "HOSTNAME",               "%s",  0, HOSTNAME);
     61 
     62  /* load valid ip list */
     63  {
     64    int i, Nvalid, ip1, ip2, ip3, ip4, test, status;
     65    char string[80];
     66
     67    Nvalid = 0;
     68    NVALID = 10;
     69    ALLOCATE (VALID_IP, int, NVALID);
     70    for (i = 0; ScanConfig (config, "VALID_IP", "%s", i, string) != NULL; i++) {
     71      status = sscanf (string, "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4);
     72      test = TRUE;
     73      test &= (status == 4);
     74      test &= ((ip1 > 0) && (ip1 < 256));
     75      test &= ((ip2 > 0) && (ip2 < 256));
     76      test &= ((ip3 > 0) && (ip3 < 256));
     77      test &= ((ip4 >=0) && (ip4 < 256));
     78      if (!test) {
     79        fprintf (stderr, "invalid IP address %s\n", string);
     80        exit (2);
     81      }
     82      VALID_IP[Nvalid] = ip1 | (ip2 << 8) | (ip3 << 16) | (ip4 << 24);
     83      Nvalid ++;
     84      CHECK_REALLOCATE (VALID_IP, int, NVALID, Nvalid, 10);
     85    }
     86    NVALID = Nvalid;
     87    REALLOCATE (VALID_IP, int, NVALID);
     88    if (NVALID == 0) {
     89      free (VALID_IP);
     90      VALID_IP = NULL;
     91    }
     92  }
     93
    5894  if (!strcasecmp (RadiusWord, "header")) {
    5995    DEFAULT_RADIUS = 0;
Note: See TracChangeset for help on using the changeset viewer.