source: freewrt/package/ez-ipupdate/patches/debian-subset.patch@ 428f140

freewrt_1_0 freewrt_2_0
Last change on this file since 428f140 was 475ad56, checked in by Waldemar Brodkorb <wbx@…>, 20 years ago

add OpenWrt trunk revision 3830.

git-svn-id: svn://www.freewrt.org/trunk/freewrt@1 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 18.5 KB
  • ez-ipupdate-3.0.11b8

    old new  
    139139#if HAVE_SIGNAL_H
    140140#  include <signal.h>
    141141#endif
     142#if HAVE_TIME_H
     143#  include <time.h>
     144#endif
    142145#if HAVE_SYS_TIME_H
    143146#  include <sys/time.h>
    144147#endif
     
    165168#endif
    166169
    167170
    168 #if __linux__ || __SVR4 || __OpenBSD__ || __FreeBSD__ || __NetBSD__
     171#if __GLIBC__ || __SVR4 || __OpenBSD__ || __FreeBSD__ || __NetBSD__
    169172#  define IF_LOOKUP 1
    170173#  include <sys/ioctl.h>
    171174#  include <net/if.h>
     
    640643  fprintf(stdout, "  -q, --quiet \t\t\tbe quiet\n");
    641644  fprintf(stdout, "  -r, --retrys <num>\t\tnumber of trys (default: 1)\n");
    642645  fprintf(stdout, "  -R, --run-as-user <user>\tchange to <user> for running, be ware\n\t\t\t\tthat this can cause problems with handeling\n\t\t\t\tSIGHUP properly if that user can't read the\n\t\t\t\tconfig file. also it can't write it's pid file \n\t\t\t\tto a root directory\n");
    643   fprintf(stdout, "  -Q, --run-as-euser <user>\tchange to effective <user> for running, \n\t\t\t\tthis is NOT secure but it does solve the \n\t\t\t\tproblems with run-as-user and config files and \n\t\t\t\tpid files.\n");
     646  fprintf(stdout, "  -Q, --run-as-euser <user>\tchange to effective <user> for running, \n\t\t\t\tthis is NOT secure but it does solve the \n\t\t\t\tproblems with run-as-user and config files and \n\t\t\t\tpid files\n");
    644647  fprintf(stdout, "  -s, --server <server[:port]>\tthe server to connect to\n");
    645648  fprintf(stdout, "  -S, --service-type <server>\tthe type of service that you are using\n");
    646649  width = fprintf(stdout, "\t\t\t\ttry one of: ") + 4*7;
     
    682685
    683686void print_signalhelp( void )
    684687{
    685   fprintf(stdout, "\nsignals are only really used when in daemon mode.\n\n");
     688  fprintf(stdout, "\nsignals are only really used when in daemon mode\n\n");
    686689  fprintf(stdout, "signals: \n");
    687690  fprintf(stdout, "  HUP\t\tcauses it to re-read its config file\n");
    688691  fprintf(stdout, "  TERM\t\twake up and possibly perform an update\n");
     
    693696#if HAVE_SIGNAL_H
    694697RETSIGTYPE sigint_handler(int sig)
    695698{
    696   char message[] = "interupted.\n";
     699  char message[] = "interrupted\n";
    697700  close(client_sockfd);
    698701  write(2, message, sizeof(message)-1);
    699702
     
    704707  }
    705708#endif
    706709
     710#if HAVE_SYSLOG_H
     711  closelog();
     712#endif
     713
    707714  exit(1);
    708715}
    709716RETSIGTYPE generic_sig_handler(int sig)
     
    798805    sprintf(buf, "message incomplete because your OS sucks: %s\n", fmt);
    799806#endif
    800807
    801     syslog(LOG_NOTICE, buf);
     808    syslog(LOG_NOTICE, "%s", buf);
    802809  }
    803810  else
    804811  {
     
    14391446  if(!(options & OPT_QUIET))
    14401447  {
    14411448    fprintf(stderr,
    1442         "connected to %s (%s) on port %d.\n",
     1449        "connected to %s (%s) on port %d\n",
    14431450        host,
    14441451        inet_ntoa(address.sin_addr),
    14451452        ntohs(address.sin_port));
     
    16831690      close(client_sockfd);
    16841691      return(-1);
    16851692    }
    1686     if(strstr(buf, "\r\n") > 0)
     1693    if(strstr(buf, "\n") != NULL)
    16871694    {
    16881695      break;
    16891696    }
     
    17021709
    17031710  if(options & OPT_DAEMON)
    17041711  {
    1705     fprintf(stderr, "no compile time default service was set therefor you must "
    1706         "specify a service type.\n");
     1712    fprintf(stderr, "no compile time default service was set, you must "
     1713        "specify a service type\n");
    17071714
    17081715    return(-1);
    17091716  }
     
    20392046        }
    20402047        else if(strstr(buf, "\nnumhost") != NULL)
    20412048        {
    2042           show_message("Too many or too few hosts found\n");
     2049          show_message("too many or too few hosts found\n");
    20432050          retval = UPDATERES_SHUTDOWN;
    20442051        }
    20452052        else if(strstr(buf, "\ndnserr") != NULL)
     
    20512058        }
    20522059        else if(strstr(buf, "\n911") != NULL)
    20532060        {
    2054           show_message("Ahhhh! call 911!\n");
     2061          show_message("ahhhh! call 911!\n");
    20552062          retval = UPDATERES_SHUTDOWN;
    20562063        }
    20572064        else if(strstr(buf, "\n999") != NULL)
    20582065        {
    2059           show_message("Ahhhh! call 999!\n");
     2066          show_message("ahhhh! call 999!\n");
    20602067          retval = UPDATERES_SHUTDOWN;
    20612068        }
    20622069        else if(strstr(buf, "\n!donator") != NULL)
    20632070        {
    2064           show_message("a feature requested is only available to donators, please donate.\n", host);
     2071          show_message("a feature requested is only available to donators, please donate\n", host);
    20652072          retval = UPDATERES_OK;
    20662073        }
    20672074        // this one should be last as it is a stupid string to signify waits
     
    20952102            sprintf(reason, "problem parsing reason for wait response");
    20962103          }
    20972104
    2098           show_message("Wait response received, waiting for %s before next update.\n",
     2105          show_message("wait response received, waiting for %s before next update\n",
    20992106              format_time(howlong));
    2100           show_message("Wait response reason: %d\n", N_STR(reason));
     2107          show_message("wait response reason: %d\n", N_STR(reason));
    21012108          sleep(howlong);
    21022109          retval = UPDATERES_ERROR;
    21032110        }
     
    33703377  {
    33713378    if(!(options & OPT_QUIET))
    33723379    {
    3373       fprintf(stderr, "warning: for GNUDIP the \"address\" parpameter is only used if set to \"0.0.0.0\" thus making an offline request.\n");
     3380      fprintf(stderr, "warning: for GNUDIP the \"address\" parameter is only used if set to \"0.0.0.0\" thus making an offline request\n");
    33743381    }
    33753382  }
    33763383
     
    33923399
    33933400  // send an offline request if address 0.0.0.0 is used
    33943401  // otherwise, we ignore the address and send an update request
    3395   gnudip_request[0] = strcmp(address, "0.0.0.0") == 0 ? '1' : '0';
     3402  gnudip_request[0] = address && strcmp(address, "0.0.0.0") == 0 ? '1' : '0';
    33963403  gnudip_request[1] = '\0';
    33973404
    33983405  // find domainname
     
    39433950          break;
    39443951
    39453952        case 201:
    3946           show_message("Last update was less than %d seconds ago.\n", 300);
     3953          show_message("last update was less than %d seconds ago\n", 300);
    39473954          return(UPDATERES_ERROR);
    39483955          break;
    39493956
    39503957        case 202:
    3951           show_message("Server error.\n");
     3958          show_message("server error\n");
    39523959          return(UPDATERES_ERROR);
    39533960          break;
    39543961
    39553962        case 203:
    3956           show_message("Failure because account is frozen (by admin).\n");
     3963          show_message("failure because account is frozen (by admin)\n");
    39573964          return(UPDATERES_SHUTDOWN);
    39583965          break;
    39593966
    39603967        case 204:
    3961           show_message("Failure because account is locked (by user).\n");
     3968          show_message("failure because account is locked (by user)\n");
    39623969          return(UPDATERES_SHUTDOWN);
    39633970          break;
    39643971
     
    42154222
    42164223  switch(ret)
    42174224  {
    4218     char *p;
    4219 
    42204225    case -1:
    42214226      if(!(options & OPT_QUIET))
    42224227      {
     
    43494354    case SIGHUP:
    43504355      if(config_file)
    43514356      {
    4352         show_message("SIGHUP recieved, re-reading config file\n");
     4357        show_message("SIGHUP received, re-reading config file\n");
    43534358        if(parse_conf_file(config_file, conf_commands) != 0)
    43544359        {
    43554360          show_message("error parsing config file \"%s\"\n", config_file);
     
    43844389
    43854390int main(int argc, char **argv)
    43864391{
     4392  char *tmp;
    43874393  int ifresolve_warned = 0;
    43884394  int i;
    43894395  int retval = 1;
     
    43954401  mcheck(NULL);
    43964402#endif
    43974403
    4398   dprintf((stderr, "staring...\n"));
     4404  dprintf((stderr, "starting...\n"));
    43994405
    4400   program_name = argv[0];
     4406  tmp = strrchr(argv[0], '/');
     4407  program_name = tmp ? tmp + 1 : argv[0];
    44014408  options = 0;
    44024409  *user = '\0';
    44034410  timeout.tv_sec = DEFAULT_TIMEOUT;
     
    44174424
    44184425  if(!(options & OPT_QUIET) && !(options & OPT_DAEMON))
    44194426  {
    4420     fprintf(stderr, "ez-ipupdate Version %s\nCopyright (C) 1998-2001 Angus Mackay.\n", VERSION);
     4427    fprintf(stderr, "%s Version %s\nCopyright (C) 1998-2001 Angus Mackay\n", program_name, VERSION);
    44214428  }
    44224429
    44234430  dprintf((stderr, "options: 0x%04X\n", options));
     
    44344441  {
    44354442    if(service->check_info() != 0)
    44364443    {
    4437       fprintf(stderr, "invalid data to perform requested action.\n");
     4444      fprintf(stderr, "invalid data to perform requested action\n");
    44384445      exit(1);
    44394446    }
    44404447  }
     
    44564463    dprintf((stderr, "user_name: %s\n", user_name));
    44574464    dprintf((stderr, "password: %s\n", password));
    44584465  }
    4459   if(*user_name == '\0')
     4466  if(*user_name == '\0' && !(options & OPT_DAEMON))
    44604467  {
    44614468    printf("user name: ");
    44624469    fgets(user_name, sizeof(user_name), stdin);
    44634470    chomp(user_name);
    44644471  }
    4465   if(*password == '\0')
     4472  if(*password == '\0' && !(options & OPT_DAEMON))
    44664473  {
    44674474    strncpy(password, getpass("password: "), sizeof(password));
    44684475  }
     
    44804487
    44814488  if(service->check_info() != 0)
    44824489  {
    4483     fprintf(stderr, "invalid data to perform requested action.\n");
     4490    fprintf(stderr, "invalid data to perform requested action\n");
    44844491    exit(1);
    44854492  }
    44864493
     
    45034510
    45044511    if(interface == NULL)
    45054512    {
    4506       fprintf(stderr, "invalid data to perform requested action.\n");
     4513      fprintf(stderr, "invalid data to perform requested action\n");
    45074514      fprintf(stderr, "you must provide an interface for daemon mode");
    45084515      exit(1);
    45094516    }
     
    45194526      if(fork() > 0) { exit(0); } /* parent */
    45204527    }
    45214528
     4529#  if HAVE_SYSLOG_H
     4530    openlog(program_name, LOG_PID, LOG_DAEMON );
     4531    //options |= OPT_QUIET;
     4532#  endif
     4533    show_message("version %s, interface %s, host %s, server %s, service %s\n",
     4534        VERSION, N_STR(interface), N_STR(host), server, service->title);
     4535
    45224536#if HAVE_GETPID
    45234537    if(pid_file && pid_file_create(pid_file) != 0)
    45244538    {
    4525       fprintf(stderr, "exiting...\n");
     4539      show_message("could not create pid file %s (%s), exiting\n",
     4540                   pid_file, strerror(errno));
     4541#if HAVE_SYSLOG_H
     4542      closelog();
     4543#endif
    45264544      exit(1);
    45274545    }
    45284546#endif
    45294547
    4530 #  if HAVE_SYSLOG_H
    4531     openlog(program_name, LOG_PID, LOG_USER );
    4532     options |= OPT_QUIET;
    4533 #  endif
    4534     show_message("ez-ipupdate Version %s, Copyright (C) 1998-2001 Angus Mackay.\n",
    4535         VERSION);
    4536     show_message("%s started for interface %s host %s using server %s and service %s\n",
    4537         program_name, N_STR(interface), N_STR(host), server, service->title);
    4538 
    45394548    memset(&sin, 0, sizeof(sin));
    45404549
    45414550    if(cache_file)
     
    45604569          strftime(timebuf, sizeof(timebuf), "%Y/%m/%d %H:%M", ts);
    45614570          show_message("got last update %s on %s from cache file\n", ipstr, timebuf);
    45624571        }
    4563         else
     4572        else if(ipstr||ipdate)
    45644573        {
    45654574          show_message("malformed cache file: %s\n", cache_file);
    45664575        }
     
    46474656          }
    46484657          else
    46494658          {
    4650             show_message("failure to update %s->%s (%s)\n",
     4659            show_message("failed to update %s->%s (%s)\n",
    46514660                interface, inet_ntoa(sin.sin_addr), N_STR(host));
    46524661            memset(&sin, 0, sizeof(sin));
    46534662
     
    46714680            dprintf((stderr, "updateres: %d\n", updateres));
    46724681            if(updateres == UPDATERES_SHUTDOWN)
    46734682            {
    4674               show_message("shuting down updater for %s due to fatal error\n",
     4683              show_message("shutting down updater for %s due to fatal error\n",
    46754684                  N_STR(host));
    46764685
    46774686              if(notify_email && *notify_email != '\0')
     
    47114720#endif
    47124721
    47134722#else
    4714     fprintf(stderr, "sorry, this mode is only available on platforms that the ");
     4723    fprintf(stderr, "sorry, this mode is only available on platforms where the ");
    47154724    fprintf(stderr, "IP address \ncan be determined. feel free to hack the code");
    47164725    fprintf(stderr, " though.\n");
    47174726    exit(1);
     
    47994808        }
    48004809        else
    48014810        {
    4802           show_message("could not resolve ip address for %s.\n", interface);
     4811          show_message("could not resolve ip address for %s\n", interface);
    48034812          exit(1);
    48044813        }
    48054814        close(sock);
  • ez-ipupdate-3.0.11b8

    old new  
    1 #!/usr/local/bin/ez-ipupdate -c
     1#!/usr/sbin/ez-ipupdate -c
    22#
    33# example config file for ez-ipupdate
    44#
  • ez-ipupdate-3.0.11b8

    old new  
    1 #!/usr/local/bin/ez-ipupdate -c
     1#!/usr/sbin/ez-ipupdate -c
    22#
    33# example config file for ez-ipupdate
    44#
     
    1010host=mydomain.penguinpowered.com
    1111interface=eth1
    1212
    13 # if you use run-as ensure the user has permission to write this file
    14 cache-file=/tmp/ez-ipupdate.cache
     13run-as-user=ez-ipupd
     14cache-file=/var/cache/ez-ipupdate/default-cache
    1515
    1616# uncomment this once you have everything working how you want and you are
    1717# ready to have ez-ipupdate running in the background all the time. to stop it
  • ez-ipupdate-3.0.11b8

    old new  
    1 #!/usr/local/bin/ez-ipupdate -c
     1#!/usr/sbin/ez-ipupdate -c
    22#
    33# example config file for ez-ipupdate
    44#
     
    1010host=mydomain.whatever.com
    1111interface=eth1
    1212
    13 # if you use run-as ensure the user has permission to write this file
    14 cache-file=/tmp/ez-ipupdate.cache
     13run-as-user=ez-ipupd
     14cache-file=/var/cache/ez-ipupdate/default-cache
    1515
    1616# uncomment this once you have everything working how you want and you are
    1717# ready to have ez-ipupdate running in the background all the time. to stop it
  • example-dyndns.conf

    old new  
    1 #!/usr/local/bin/ez-ipupdate -c
     1#!/usr/sbin/ez-ipupdate -c
    22#
    33# example config file for ez-ipupdate
    44#
     
    1212interface=eth1
    1313max-interval=2073600
    1414
    15 # please create this file and ensure that the user that ez-ipupdate is running
    16 # as has write permissions to it then uncomment this line, if you don't your
    17 # dyndns account will probably get banned. if you run ez-ipupdate as root (bad
    18 # idea, use "run-as-user") then you can just uncomment this line.
    19 #cache-file=/etc/ez-ipupdate.cache.eth1
    20 
    21 # for the mean time we'll just use a cache file in the temp directory
    22 cache-file=/tmp/ez-ipupdate.cache
     15# if you don't use a cache file your dyndns account will probably get banned.
     16run-as-user=ez-ipupd
     17cache-file=/var/cache/ez-ipupdate/default-cache
    2318
    2419# uncomment this once you have everything working how you want and you are
    2520# ready to have ez-ipupdate running in the background all the time. to stop it
  • ez-ipupdate-3.0.11b8

    old new  
    1 #!/usr/local/bin/ez-ipupdate -c
     1#!/usr/sbin/ez-ipupdate -c
    22#
    33# example config file for ez-ipupdate
    44#
     
    1010host=mydomain.ods.org
    1111interface=eth1
    1212
    13 # if you use run-as ensure the user has permission to write this file
    14 cache-file=/tmp/ez-ipupdate.cache
     13run-as-user=ez-ipupd
     14cache-file=/var/cache/ez-ipupdate/default-cache
    1515
    1616# uncomment this once you have everything working how you want and you are
    1717# ready to have ez-ipupdate running in the background all the time. to stop it
  • ez-ipupdate-3.0.11b8

    old new  
    1 #!/usr/local/bin/ez-ipupdate -c
     1#!/usr/sbin/ez-ipupdate -c
    22#
    33# example config file for ez-ipupdate
    44#
     
    1414max-interval=2073600
    1515interface=eth1
    1616
    17 # if you use run-as ensure the user has permission to write this file
    18 cache-file=/tmp/ez-ipupdate.cache
     17run-as-user=ez-ipupd
     18cache-file=/var/cache/ez-ipupdate/default-cache
    1919
    2020# uncomment this once you have everything working how you want and you are
    2121# ready to have ez-ipupdate running in the background all the time. to stop it
  • example-gnudip.conf

    old new  
    1 #!/usr/local/bin/ez-ipupdate -c
     1#!/usr/sbin/ez-ipupdate -c
    22#
    33# example config file for ez-ipupdate
    44#
     
    1414# any other value is ignored
    1515#address=0.0.0.0
    1616
    17 # if you use run-as ensure the user has permission to write this file
    18 cache-file=/tmp/ez-ipupdate.cache
     17run-as-user=ez-ipupd
     18cache-file=/var/cache/ez-ipupdate/default-cache
    1919
    2020# uncomment this once you have everything working how you want and you are
    2121# ready to have ez-ipupdate running in the background all the time. to stop it
  • example-easydns.conf

    old new  
    1 #!/usr/local/bin/ez-ipupdate -c
     1#!/usr/sbin/ez-ipupdate -c
    22#
    33# example config file for ez-ipupdate
    44#
     
    1010host=mydomain.whatever.com
    1111interface=eth1
    1212
    13 # if you use run-as ensure the user has permission to write this file
    14 cache-file=/tmp/ez-ipupdate.cache
     13run-as-user=ez-ipupd
     14cache-file=/var/cache/ez-ipupdate/default-cache
    1515
    1616# uncomment this once you have everything working how you want and you are
    1717# ready to have ez-ipupdate running in the background all the time. to stop it
  • example-justlinux.conf

    old new  
    1 #!/usr/local/bin/ez-ipupdate -c
     1#!/usr/sbin/ez-ipupdate -c
    22#
    33# example config file for ez-ipupdate
    44#
     
    1010host=mydomain.penguinpowered.com
    1111interface=eth1
    1212
    13 # if you use run-as ensure the user has permission to write this file
    14 cache-file=/tmp/ez-ipupdate.cache
     13run-as-user=ez-ipupd
     14cache-file=/var/cache/ez-ipupdate/default-cache
    1515
    1616# uncomment this once you have everything working how you want and you are
    1717# ready to have ez-ipupdate running in the background all the time. to stop it
  • ez-ipupdate-3.0.11b8

    old new  
    1 #!/usr/local/bin/ez-ipupdate -c
     1#!/usr/sbin/ez-ipupdate -c
    22#
    33# example config file for ez-ipupdate
    44#
     
    1010host=myhost
    1111#interface=eth1
    1212
    13 # if you use run-as ensure the user has permission to write this file
    14 #cache-file=/tmp/ez-ipupdate.cache
     13run-as-user=ez-ipupd
     14cache-file=/var/cache/ez-ipupdate/default-cache
    1515
    1616# uncomment this once you have everything working how you want and you are
    1717# ready to have ez-ipupdate running in the background all the time. to stop it
  • example-heipv6tb.conf

    old new  
    1 #!/usr/local/bin/ez-ipupdate -c
     1#!/usr/sbin/ez-ipupdate -c
    22#
    33# example config file for ez-ipupdate
    44#
     
    1111interface=eth1
    1212max-interval=2073600
    1313
    14 # please create this file and ensure that the user that ez-ipupdate is running
    15 # as has write permissions to it then uncomment this line, if you don't your
    16 # dyndns account will probably get banned. if you run ez-ipupdate as root (bad
    17 # idea, use "run-as-user") then you can just uncomment this line.
    18 #cache-file=/etc/ez-ipupdate.cache.eth1
    19 
    20 # for the mean time we'll just use a cache file in the temp directory
    21 cache-file=/tmp/ez-ipupdate.cache
     14# if you don't use a cache file your account will probably get banned.
     15run-as-user=ez-ipupd
     16cache-file=/var/cache/ez-ipupdate/default-cache
    2217
    2318# uncomment this once you have everything working how you want and you are
    2419# ready to have ez-ipupdate running in the background all the time. to stop it
Note: See TracBrowser for help on using the repository browser.