1 --- ez-ipupdate-3.0.11b8.orig/ez-ipupdate.c
2 +++ ez-ipupdate-3.0.11b8/ez-ipupdate.c
11 # include <sys/time.h>
17 -#if __linux__ || __SVR4 || __OpenBSD__ || __FreeBSD__ || __NetBSD__
18 +#if __GLIBC__ || __SVR4 || __OpenBSD__ || __FreeBSD__ || __NetBSD__
20 # include <sys/ioctl.h>
23 fprintf(stdout, " -q, --quiet \t\t\tbe quiet\n");
24 fprintf(stdout, " -r, --retrys <num>\t\tnumber of trys (default: 1)\n");
25 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");
26 - 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");
27 + 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");
28 fprintf(stdout, " -s, --server <server[:port]>\tthe server to connect to\n");
29 fprintf(stdout, " -S, --service-type <server>\tthe type of service that you are using\n");
30 width = fprintf(stdout, "\t\t\t\ttry one of: ") + 4*7;
33 void print_signalhelp( void )
35 - fprintf(stdout, "\nsignals are only really used when in daemon mode.\n\n");
36 + fprintf(stdout, "\nsignals are only really used when in daemon mode\n\n");
37 fprintf(stdout, "signals: \n");
38 fprintf(stdout, " HUP\t\tcauses it to re-read its config file\n");
39 fprintf(stdout, " TERM\t\twake up and possibly perform an update\n");
42 RETSIGTYPE sigint_handler(int sig)
44 - char message[] = "interupted.\n";
45 + char message[] = "interrupted\n";
47 write(2, message, sizeof(message)-1);
59 RETSIGTYPE generic_sig_handler(int sig)
61 sprintf(buf, "message incomplete because your OS sucks: %s\n", fmt);
64 - syslog(LOG_NOTICE, buf);
65 + syslog(LOG_NOTICE, "%s", buf);
70 if(!(options & OPT_QUIET))
73 - "connected to %s (%s) on port %d.\n",
74 + "connected to %s (%s) on port %d\n",
76 inet_ntoa(address.sin_addr),
77 ntohs(address.sin_port));
82 - if(strstr(buf, "\r\n") > 0)
83 + if(strstr(buf, "\n") != NULL)
89 if(options & OPT_DAEMON)
91 - fprintf(stderr, "no compile time default service was set therefor you must "
92 - "specify a service type.\n");
93 + fprintf(stderr, "no compile time default service was set, you must "
94 + "specify a service type\n");
100 else if(strstr(buf, "\nnumhost") != NULL)
102 - show_message("Too many or too few hosts found\n");
103 + show_message("too many or too few hosts found\n");
104 retval = UPDATERES_SHUTDOWN;
106 else if(strstr(buf, "\ndnserr") != NULL)
107 @@ -2051,17 +2058,17 @@
109 else if(strstr(buf, "\n911") != NULL)
111 - show_message("Ahhhh! call 911!\n");
112 + show_message("ahhhh! call 911!\n");
113 retval = UPDATERES_SHUTDOWN;
115 else if(strstr(buf, "\n999") != NULL)
117 - show_message("Ahhhh! call 999!\n");
118 + show_message("ahhhh! call 999!\n");
119 retval = UPDATERES_SHUTDOWN;
121 else if(strstr(buf, "\n!donator") != NULL)
123 - show_message("a feature requested is only available to donators, please donate.\n", host);
124 + show_message("a feature requested is only available to donators, please donate\n", host);
125 retval = UPDATERES_OK;
127 // this one should be last as it is a stupid string to signify waits
128 @@ -2095,9 +2102,9 @@
129 sprintf(reason, "problem parsing reason for wait response");
132 - show_message("Wait response received, waiting for %s before next update.\n",
133 + show_message("wait response received, waiting for %s before next update\n",
134 format_time(howlong));
135 - show_message("Wait response reason: %d\n", N_STR(reason));
136 + show_message("wait response reason: %d\n", N_STR(reason));
138 retval = UPDATERES_ERROR;
140 @@ -3370,7 +3377,7 @@
142 if(!(options & OPT_QUIET))
144 - fprintf(stderr, "warning: for GNUDIP the \"address\" parpameter is only used if set to \"0.0.0.0\" thus making an offline request.\n");
145 + fprintf(stderr, "warning: for GNUDIP the \"address\" parameter is only used if set to \"0.0.0.0\" thus making an offline request\n");
149 @@ -3392,7 +3399,7 @@
151 // send an offline request if address 0.0.0.0 is used
152 // otherwise, we ignore the address and send an update request
153 - gnudip_request[0] = strcmp(address, "0.0.0.0") == 0 ? '1' : '0';
154 + gnudip_request[0] = address && strcmp(address, "0.0.0.0") == 0 ? '1' : '0';
155 gnudip_request[1] = '\0';
158 @@ -3943,22 +3950,22 @@
162 - show_message("Last update was less than %d seconds ago.\n", 300);
163 + show_message("last update was less than %d seconds ago\n", 300);
164 return(UPDATERES_ERROR);
168 - show_message("Server error.\n");
169 + show_message("server error\n");
170 return(UPDATERES_ERROR);
174 - show_message("Failure because account is frozen (by admin).\n");
175 + show_message("failure because account is frozen (by admin)\n");
176 return(UPDATERES_SHUTDOWN);
180 - show_message("Failure because account is locked (by user).\n");
181 + show_message("failure because account is locked (by user)\n");
182 return(UPDATERES_SHUTDOWN);
185 @@ -4215,8 +4222,6 @@
192 if(!(options & OPT_QUIET))
194 @@ -4349,7 +4354,7 @@
198 - show_message("SIGHUP recieved, re-reading config file\n");
199 + show_message("SIGHUP received, re-reading config file\n");
200 if(parse_conf_file(config_file, conf_commands) != 0)
202 show_message("error parsing config file \"%s\"\n", config_file);
203 @@ -4384,6 +4389,7 @@
205 int main(int argc, char **argv)
208 int ifresolve_warned = 0;
211 @@ -4395,9 +4401,10 @@
215 - dprintf((stderr, "staring...\n"));
216 + dprintf((stderr, "starting...\n"));
218 - program_name = argv[0];
219 + tmp = strrchr(argv[0], '/');
220 + program_name = tmp ? tmp + 1 : argv[0];
223 timeout.tv_sec = DEFAULT_TIMEOUT;
224 @@ -4417,7 +4424,7 @@
226 if(!(options & OPT_QUIET) && !(options & OPT_DAEMON))
228 - fprintf(stderr, "ez-ipupdate Version %s\nCopyright (C) 1998-2001 Angus Mackay.\n", VERSION);
229 + fprintf(stderr, "%s Version %s\nCopyright (C) 1998-2001 Angus Mackay\n", program_name, VERSION);
232 dprintf((stderr, "options: 0x%04X\n", options));
233 @@ -4434,7 +4441,7 @@
235 if(service->check_info() != 0)
237 - fprintf(stderr, "invalid data to perform requested action.\n");
238 + fprintf(stderr, "invalid data to perform requested action\n");
242 @@ -4456,13 +4463,13 @@
243 dprintf((stderr, "user_name: %s\n", user_name));
244 dprintf((stderr, "password: %s\n", password));
246 - if(*user_name == '\0')
247 + if(*user_name == '\0' && !(options & OPT_DAEMON))
249 printf("user name: ");
250 fgets(user_name, sizeof(user_name), stdin);
253 - if(*password == '\0')
254 + if(*password == '\0' && !(options & OPT_DAEMON))
256 strncpy(password, getpass("password: "), sizeof(password));
258 @@ -4480,7 +4487,7 @@
260 if(service->check_info() != 0)
262 - fprintf(stderr, "invalid data to perform requested action.\n");
263 + fprintf(stderr, "invalid data to perform requested action\n");
267 @@ -4503,7 +4510,7 @@
269 if(interface == NULL)
271 - fprintf(stderr, "invalid data to perform requested action.\n");
272 + fprintf(stderr, "invalid data to perform requested action\n");
273 fprintf(stderr, "you must provide an interface for daemon mode");
276 @@ -4519,23 +4526,25 @@
277 if(fork() > 0) { exit(0); } /* parent */
281 + openlog(program_name, LOG_PID, LOG_DAEMON );
282 + //options |= OPT_QUIET;
284 + show_message("version %s, interface %s, host %s, server %s, service %s\n",
285 + VERSION, N_STR(interface), N_STR(host), server, service->title);
288 if(pid_file && pid_file_create(pid_file) != 0)
290 - fprintf(stderr, "exiting...\n");
291 + show_message("could not create pid file %s (%s), exiting\n",
292 + pid_file, strerror(errno));
301 - openlog(program_name, LOG_PID, LOG_USER );
302 - options |= OPT_QUIET;
304 - show_message("ez-ipupdate Version %s, Copyright (C) 1998-2001 Angus Mackay.\n",
306 - show_message("%s started for interface %s host %s using server %s and service %s\n",
307 - program_name, N_STR(interface), N_STR(host), server, service->title);
309 memset(&sin, 0, sizeof(sin));
312 @@ -4560,7 +4569,7 @@
313 strftime(timebuf, sizeof(timebuf), "%Y/%m/%d %H:%M", ts);
314 show_message("got last update %s on %s from cache file\n", ipstr, timebuf);
317 + else if(ipstr||ipdate)
319 show_message("malformed cache file: %s\n", cache_file);
321 @@ -4647,7 +4656,7 @@
325 - show_message("failure to update %s->%s (%s)\n",
326 + show_message("failed to update %s->%s (%s)\n",
327 interface, inet_ntoa(sin.sin_addr), N_STR(host));
328 memset(&sin, 0, sizeof(sin));
330 @@ -4671,7 +4680,7 @@
331 dprintf((stderr, "updateres: %d\n", updateres));
332 if(updateres == UPDATERES_SHUTDOWN)
334 - show_message("shuting down updater for %s due to fatal error\n",
335 + show_message("shutting down updater for %s due to fatal error\n",
338 if(notify_email && *notify_email != '\0')
339 @@ -4711,7 +4720,7 @@
343 - fprintf(stderr, "sorry, this mode is only available on platforms that the ");
344 + fprintf(stderr, "sorry, this mode is only available on platforms where the ");
345 fprintf(stderr, "IP address \ncan be determined. feel free to hack the code");
346 fprintf(stderr, " though.\n");
348 @@ -4799,7 +4808,7 @@
352 - show_message("could not resolve ip address for %s.\n", interface);
353 + show_message("could not resolve ip address for %s\n", interface);
357 --- ez-ipupdate-3.0.11b8.orig/example.conf
358 +++ ez-ipupdate-3.0.11b8/example.conf
360 -#!/usr/local/bin/ez-ipupdate -c
361 +#!/usr/sbin/ez-ipupdate -c
363 # example config file for ez-ipupdate
365 --- ez-ipupdate-3.0.11b8.orig/example-pgpow.conf
366 +++ ez-ipupdate-3.0.11b8/example-pgpow.conf
368 -#!/usr/local/bin/ez-ipupdate -c
369 +#!/usr/sbin/ez-ipupdate -c
371 # example config file for ez-ipupdate
374 host=mydomain.penguinpowered.com
377 -# if you use run-as ensure the user has permission to write this file
378 -cache-file=/tmp/ez-ipupdate.cache
379 +run-as-user=ez-ipupd
380 +cache-file=/var/cache/ez-ipupdate/default-cache
382 # uncomment this once you have everything working how you want and you are
383 # ready to have ez-ipupdate running in the background all the time. to stop it
384 --- ez-ipupdate-3.0.11b8.orig/example-dhs.conf
385 +++ ez-ipupdate-3.0.11b8/example-dhs.conf
387 -#!/usr/local/bin/ez-ipupdate -c
388 +#!/usr/sbin/ez-ipupdate -c
390 # example config file for ez-ipupdate
393 host=mydomain.whatever.com
396 -# if you use run-as ensure the user has permission to write this file
397 -cache-file=/tmp/ez-ipupdate.cache
398 +run-as-user=ez-ipupd
399 +cache-file=/var/cache/ez-ipupdate/default-cache
401 # uncomment this once you have everything working how you want and you are
402 # ready to have ez-ipupdate running in the background all the time. to stop it
403 --- ez-ipupdate-3.0.11b8.orig/example-dyndns.conf
404 +++ ez-ipupdate-3.0.11b8/example-dyndns.conf
406 -#!/usr/local/bin/ez-ipupdate -c
407 +#!/usr/sbin/ez-ipupdate -c
409 # example config file for ez-ipupdate
415 -# please create this file and ensure that the user that ez-ipupdate is running
416 -# as has write permissions to it then uncomment this line, if you don't your
417 -# dyndns account will probably get banned. if you run ez-ipupdate as root (bad
418 -# idea, use "run-as-user") then you can just uncomment this line.
419 -#cache-file=/etc/ez-ipupdate.cache.eth1
421 -# for the mean time we'll just use a cache file in the temp directory
422 -cache-file=/tmp/ez-ipupdate.cache
423 +# if you don't use a cache file your dyndns account will probably get banned.
424 +run-as-user=ez-ipupd
425 +cache-file=/var/cache/ez-ipupdate/default-cache
427 # uncomment this once you have everything working how you want and you are
428 # ready to have ez-ipupdate running in the background all the time. to stop it
429 --- ez-ipupdate-3.0.11b8.orig/example-ods.conf
430 +++ ez-ipupdate-3.0.11b8/example-ods.conf
432 -#!/usr/local/bin/ez-ipupdate -c
433 +#!/usr/sbin/ez-ipupdate -c
435 # example config file for ez-ipupdate
438 host=mydomain.ods.org
441 -# if you use run-as ensure the user has permission to write this file
442 -cache-file=/tmp/ez-ipupdate.cache
443 +run-as-user=ez-ipupd
444 +cache-file=/var/cache/ez-ipupdate/default-cache
446 # uncomment this once you have everything working how you want and you are
447 # ready to have ez-ipupdate running in the background all the time. to stop it
448 --- ez-ipupdate-3.0.11b8.orig/example-tzo.conf
449 +++ ez-ipupdate-3.0.11b8/example-tzo.conf
451 -#!/usr/local/bin/ez-ipupdate -c
452 +#!/usr/sbin/ez-ipupdate -c
454 # example config file for ez-ipupdate
460 -# if you use run-as ensure the user has permission to write this file
461 -cache-file=/tmp/ez-ipupdate.cache
462 +run-as-user=ez-ipupd
463 +cache-file=/var/cache/ez-ipupdate/default-cache
465 # uncomment this once you have everything working how you want and you are
466 # ready to have ez-ipupdate running in the background all the time. to stop it
467 --- ez-ipupdate-3.0.11b8.orig/example-gnudip.conf
468 +++ ez-ipupdate-3.0.11b8/example-gnudip.conf
470 -#!/usr/local/bin/ez-ipupdate -c
471 +#!/usr/sbin/ez-ipupdate -c
473 # example config file for ez-ipupdate
476 # any other value is ignored
479 -# if you use run-as ensure the user has permission to write this file
480 -cache-file=/tmp/ez-ipupdate.cache
481 +run-as-user=ez-ipupd
482 +cache-file=/var/cache/ez-ipupdate/default-cache
484 # uncomment this once you have everything working how you want and you are
485 # ready to have ez-ipupdate running in the background all the time. to stop it
486 --- ez-ipupdate-3.0.11b8.orig/example-easydns.conf
487 +++ ez-ipupdate-3.0.11b8/example-easydns.conf
489 -#!/usr/local/bin/ez-ipupdate -c
490 +#!/usr/sbin/ez-ipupdate -c
492 # example config file for ez-ipupdate
495 host=mydomain.whatever.com
498 -# if you use run-as ensure the user has permission to write this file
499 -cache-file=/tmp/ez-ipupdate.cache
500 +run-as-user=ez-ipupd
501 +cache-file=/var/cache/ez-ipupdate/default-cache
503 # uncomment this once you have everything working how you want and you are
504 # ready to have ez-ipupdate running in the background all the time. to stop it
505 --- ez-ipupdate-3.0.11b8.orig/example-justlinux.conf
506 +++ ez-ipupdate-3.0.11b8/example-justlinux.conf
508 -#!/usr/local/bin/ez-ipupdate -c
509 +#!/usr/sbin/ez-ipupdate -c
511 # example config file for ez-ipupdate
514 host=mydomain.penguinpowered.com
517 -# if you use run-as ensure the user has permission to write this file
518 -cache-file=/tmp/ez-ipupdate.cache
519 +run-as-user=ez-ipupd
520 +cache-file=/var/cache/ez-ipupdate/default-cache
522 # uncomment this once you have everything working how you want and you are
523 # ready to have ez-ipupdate running in the background all the time. to stop it
524 --- ez-ipupdate-3.0.11b8.orig/example-dyns.conf
525 +++ ez-ipupdate-3.0.11b8/example-dyns.conf
527 -#!/usr/local/bin/ez-ipupdate -c
528 +#!/usr/sbin/ez-ipupdate -c
530 # example config file for ez-ipupdate
536 -# if you use run-as ensure the user has permission to write this file
537 -#cache-file=/tmp/ez-ipupdate.cache
538 +run-as-user=ez-ipupd
539 +cache-file=/var/cache/ez-ipupdate/default-cache
541 # uncomment this once you have everything working how you want and you are
542 # ready to have ez-ipupdate running in the background all the time. to stop it
543 --- ez-ipupdate-3.0.11b8.orig/example-heipv6tb.conf
544 +++ ez-ipupdate-3.0.11b8/example-heipv6tb.conf
546 -#!/usr/local/bin/ez-ipupdate -c
547 +#!/usr/sbin/ez-ipupdate -c
549 # example config file for ez-ipupdate
555 -# please create this file and ensure that the user that ez-ipupdate is running
556 -# as has write permissions to it then uncomment this line, if you don't your
557 -# dyndns account will probably get banned. if you run ez-ipupdate as root (bad
558 -# idea, use "run-as-user") then you can just uncomment this line.
559 -#cache-file=/etc/ez-ipupdate.cache.eth1
561 -# for the mean time we'll just use a cache file in the temp directory
562 -cache-file=/tmp/ez-ipupdate.cache
563 +# if you don't use a cache file your account will probably get banned.
564 +run-as-user=ez-ipupd
565 +cache-file=/var/cache/ez-ipupdate/default-cache
567 # uncomment this once you have everything working how you want and you are
568 # ready to have ez-ipupdate running in the background all the time. to stop it