let ipkg fail when a package file to be installed is not found
[openwrt/svn-archive/archive.git] / openwrt / package / ez-ipupdate / patches / debian-subset.patch
1 --- ez-ipupdate-3.0.11b8.orig/ez-ipupdate.c
2 +++ ez-ipupdate-3.0.11b8/ez-ipupdate.c
3 @@ -139,6 +139,9 @@
4 #if HAVE_SIGNAL_H
5 # include <signal.h>
6 #endif
7 +#if HAVE_TIME_H
8 +# include <time.h>
9 +#endif
10 #if HAVE_SYS_TIME_H
11 # include <sys/time.h>
12 #endif
13 @@ -165,7 +168,7 @@
14 #endif
15
16
17 -#if __linux__ || __SVR4 || __OpenBSD__ || __FreeBSD__ || __NetBSD__
18 +#if __GLIBC__ || __SVR4 || __OpenBSD__ || __FreeBSD__ || __NetBSD__
19 # define IF_LOOKUP 1
20 # include <sys/ioctl.h>
21 # include <net/if.h>
22 @@ -640,7 +643,7 @@
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;
31 @@ -682,7 +685,7 @@
32
33 void print_signalhelp( void )
34 {
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");
40 @@ -693,7 +696,7 @@
41 #if HAVE_SIGNAL_H
42 RETSIGTYPE sigint_handler(int sig)
43 {
44 - char message[] = "interupted.\n";
45 + char message[] = "interrupted\n";
46 close(client_sockfd);
47 write(2, message, sizeof(message)-1);
48
49 @@ -704,6 +707,10 @@
50 }
51 #endif
52
53 +#if HAVE_SYSLOG_H
54 + closelog();
55 +#endif
56 +
57 exit(1);
58 }
59 RETSIGTYPE generic_sig_handler(int sig)
60 @@ -798,7 +805,7 @@
61 sprintf(buf, "message incomplete because your OS sucks: %s\n", fmt);
62 #endif
63
64 - syslog(LOG_NOTICE, buf);
65 + syslog(LOG_NOTICE, "%s", buf);
66 }
67 else
68 {
69 @@ -1439,7 +1446,7 @@
70 if(!(options & OPT_QUIET))
71 {
72 fprintf(stderr,
73 - "connected to %s (%s) on port %d.\n",
74 + "connected to %s (%s) on port %d\n",
75 host,
76 inet_ntoa(address.sin_addr),
77 ntohs(address.sin_port));
78 @@ -1683,7 +1690,7 @@
79 close(client_sockfd);
80 return(-1);
81 }
82 - if(strstr(buf, "\r\n") > 0)
83 + if(strstr(buf, "\n") != NULL)
84 {
85 break;
86 }
87 @@ -1702,8 +1709,8 @@
88
89 if(options & OPT_DAEMON)
90 {
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");
95
96 return(-1);
97 }
98 @@ -2039,7 +2046,7 @@
99 }
100 else if(strstr(buf, "\nnumhost") != NULL)
101 {
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;
105 }
106 else if(strstr(buf, "\ndnserr") != NULL)
107 @@ -2051,17 +2058,17 @@
108 }
109 else if(strstr(buf, "\n911") != NULL)
110 {
111 - show_message("Ahhhh! call 911!\n");
112 + show_message("ahhhh! call 911!\n");
113 retval = UPDATERES_SHUTDOWN;
114 }
115 else if(strstr(buf, "\n999") != NULL)
116 {
117 - show_message("Ahhhh! call 999!\n");
118 + show_message("ahhhh! call 999!\n");
119 retval = UPDATERES_SHUTDOWN;
120 }
121 else if(strstr(buf, "\n!donator") != NULL)
122 {
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;
126 }
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");
130 }
131
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));
137 sleep(howlong);
138 retval = UPDATERES_ERROR;
139 }
140 @@ -3370,7 +3377,7 @@
141 {
142 if(!(options & OPT_QUIET))
143 {
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");
146 }
147 }
148
149 @@ -3392,7 +3399,7 @@
150
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';
156
157 // find domainname
158 @@ -3943,22 +3950,22 @@
159 break;
160
161 case 201:
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);
165 break;
166
167 case 202:
168 - show_message("Server error.\n");
169 + show_message("server error\n");
170 return(UPDATERES_ERROR);
171 break;
172
173 case 203:
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);
177 break;
178
179 case 204:
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);
183 break;
184
185 @@ -4215,8 +4222,6 @@
186
187 switch(ret)
188 {
189 - char *p;
190 -
191 case -1:
192 if(!(options & OPT_QUIET))
193 {
194 @@ -4349,7 +4354,7 @@
195 case SIGHUP:
196 if(config_file)
197 {
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)
201 {
202 show_message("error parsing config file \"%s\"\n", config_file);
203 @@ -4384,6 +4389,7 @@
204
205 int main(int argc, char **argv)
206 {
207 + char *tmp;
208 int ifresolve_warned = 0;
209 int i;
210 int retval = 1;
211 @@ -4395,9 +4401,10 @@
212 mcheck(NULL);
213 #endif
214
215 - dprintf((stderr, "staring...\n"));
216 + dprintf((stderr, "starting...\n"));
217
218 - program_name = argv[0];
219 + tmp = strrchr(argv[0], '/');
220 + program_name = tmp ? tmp + 1 : argv[0];
221 options = 0;
222 *user = '\0';
223 timeout.tv_sec = DEFAULT_TIMEOUT;
224 @@ -4417,7 +4424,7 @@
225
226 if(!(options & OPT_QUIET) && !(options & OPT_DAEMON))
227 {
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);
230 }
231
232 dprintf((stderr, "options: 0x%04X\n", options));
233 @@ -4434,7 +4441,7 @@
234 {
235 if(service->check_info() != 0)
236 {
237 - fprintf(stderr, "invalid data to perform requested action.\n");
238 + fprintf(stderr, "invalid data to perform requested action\n");
239 exit(1);
240 }
241 }
242 @@ -4456,13 +4463,13 @@
243 dprintf((stderr, "user_name: %s\n", user_name));
244 dprintf((stderr, "password: %s\n", password));
245 }
246 - if(*user_name == '\0')
247 + if(*user_name == '\0' && !(options & OPT_DAEMON))
248 {
249 printf("user name: ");
250 fgets(user_name, sizeof(user_name), stdin);
251 chomp(user_name);
252 }
253 - if(*password == '\0')
254 + if(*password == '\0' && !(options & OPT_DAEMON))
255 {
256 strncpy(password, getpass("password: "), sizeof(password));
257 }
258 @@ -4480,7 +4487,7 @@
259
260 if(service->check_info() != 0)
261 {
262 - fprintf(stderr, "invalid data to perform requested action.\n");
263 + fprintf(stderr, "invalid data to perform requested action\n");
264 exit(1);
265 }
266
267 @@ -4503,7 +4510,7 @@
268
269 if(interface == NULL)
270 {
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");
274 exit(1);
275 }
276 @@ -4519,23 +4526,25 @@
277 if(fork() > 0) { exit(0); } /* parent */
278 }
279
280 +# if HAVE_SYSLOG_H
281 + openlog(program_name, LOG_PID, LOG_DAEMON );
282 + //options |= OPT_QUIET;
283 +# endif
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);
286 +
287 #if HAVE_GETPID
288 if(pid_file && pid_file_create(pid_file) != 0)
289 {
290 - fprintf(stderr, "exiting...\n");
291 + show_message("could not create pid file %s (%s), exiting\n",
292 + pid_file, strerror(errno));
293 +#if HAVE_SYSLOG_H
294 + closelog();
295 +#endif
296 exit(1);
297 }
298 #endif
299
300 -# if HAVE_SYSLOG_H
301 - openlog(program_name, LOG_PID, LOG_USER );
302 - options |= OPT_QUIET;
303 -# endif
304 - show_message("ez-ipupdate Version %s, Copyright (C) 1998-2001 Angus Mackay.\n",
305 - VERSION);
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);
308 -
309 memset(&sin, 0, sizeof(sin));
310
311 if(cache_file)
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);
315 }
316 - else
317 + else if(ipstr||ipdate)
318 {
319 show_message("malformed cache file: %s\n", cache_file);
320 }
321 @@ -4647,7 +4656,7 @@
322 }
323 else
324 {
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));
329
330 @@ -4671,7 +4680,7 @@
331 dprintf((stderr, "updateres: %d\n", updateres));
332 if(updateres == UPDATERES_SHUTDOWN)
333 {
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",
336 N_STR(host));
337
338 if(notify_email && *notify_email != '\0')
339 @@ -4711,7 +4720,7 @@
340 #endif
341
342 #else
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");
347 exit(1);
348 @@ -4799,7 +4808,7 @@
349 }
350 else
351 {
352 - show_message("could not resolve ip address for %s.\n", interface);
353 + show_message("could not resolve ip address for %s\n", interface);
354 exit(1);
355 }
356 close(sock);
357 --- ez-ipupdate-3.0.11b8.orig/example.conf
358 +++ ez-ipupdate-3.0.11b8/example.conf
359 @@ -1,4 +1,4 @@
360 -#!/usr/local/bin/ez-ipupdate -c
361 +#!/usr/sbin/ez-ipupdate -c
362 #
363 # example config file for ez-ipupdate
364 #
365 --- ez-ipupdate-3.0.11b8.orig/example-pgpow.conf
366 +++ ez-ipupdate-3.0.11b8/example-pgpow.conf
367 @@ -1,4 +1,4 @@
368 -#!/usr/local/bin/ez-ipupdate -c
369 +#!/usr/sbin/ez-ipupdate -c
370 #
371 # example config file for ez-ipupdate
372 #
373 @@ -10,8 +10,8 @@
374 host=mydomain.penguinpowered.com
375 interface=eth1
376
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
381
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
386 @@ -1,4 +1,4 @@
387 -#!/usr/local/bin/ez-ipupdate -c
388 +#!/usr/sbin/ez-ipupdate -c
389 #
390 # example config file for ez-ipupdate
391 #
392 @@ -10,8 +10,8 @@
393 host=mydomain.whatever.com
394 interface=eth1
395
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
400
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
405 @@ -1,4 +1,4 @@
406 -#!/usr/local/bin/ez-ipupdate -c
407 +#!/usr/sbin/ez-ipupdate -c
408 #
409 # example config file for ez-ipupdate
410 #
411 @@ -12,14 +12,9 @@
412 interface=eth1
413 max-interval=2073600
414
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
420 -
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
426
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
431 @@ -1,4 +1,4 @@
432 -#!/usr/local/bin/ez-ipupdate -c
433 +#!/usr/sbin/ez-ipupdate -c
434 #
435 # example config file for ez-ipupdate
436 #
437 @@ -10,8 +10,8 @@
438 host=mydomain.ods.org
439 interface=eth1
440
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
445
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
450 @@ -1,4 +1,4 @@
451 -#!/usr/local/bin/ez-ipupdate -c
452 +#!/usr/sbin/ez-ipupdate -c
453 #
454 # example config file for ez-ipupdate
455 #
456 @@ -14,8 +14,8 @@
457 max-interval=2073600
458 interface=eth1
459
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
464
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
469 @@ -1,4 +1,4 @@
470 -#!/usr/local/bin/ez-ipupdate -c
471 +#!/usr/sbin/ez-ipupdate -c
472 #
473 # example config file for ez-ipupdate
474 #
475 @@ -14,8 +14,8 @@
476 # any other value is ignored
477 #address=0.0.0.0
478
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
483
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
488 @@ -1,4 +1,4 @@
489 -#!/usr/local/bin/ez-ipupdate -c
490 +#!/usr/sbin/ez-ipupdate -c
491 #
492 # example config file for ez-ipupdate
493 #
494 @@ -10,8 +10,8 @@
495 host=mydomain.whatever.com
496 interface=eth1
497
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
502
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
507 @@ -1,4 +1,4 @@
508 -#!/usr/local/bin/ez-ipupdate -c
509 +#!/usr/sbin/ez-ipupdate -c
510 #
511 # example config file for ez-ipupdate
512 #
513 @@ -10,8 +10,8 @@
514 host=mydomain.penguinpowered.com
515 interface=eth1
516
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
521
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
526 @@ -1,4 +1,4 @@
527 -#!/usr/local/bin/ez-ipupdate -c
528 +#!/usr/sbin/ez-ipupdate -c
529 #
530 # example config file for ez-ipupdate
531 #
532 @@ -10,8 +10,8 @@
533 host=myhost
534 #interface=eth1
535
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
540
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
545 @@ -1,4 +1,4 @@
546 -#!/usr/local/bin/ez-ipupdate -c
547 +#!/usr/sbin/ez-ipupdate -c
548 #
549 # example config file for ez-ipupdate
550 #
551 @@ -11,14 +11,9 @@
552 interface=eth1
553 max-interval=2073600
554
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
560 -
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
566
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