1 diff -Naur ez-ipupdate-3.0.11b8-patched/example-dnsexit.conf ez-ipupdate-3.0.11b8-dnsexit/example-dnsexit.conf
2 --- ez-ipupdate-3.0.11b8-patched/example-dnsexit.conf 1970-01-01 01:00:00.000000000 +0100
3 +++ ez-ipupdate-3.0.11b8-dnsexit/example-dnsexit.conf 2005-12-23 01:34:51.000000000 +0000
5 +#!/usr/sbin/ez-ipupdate -c
7 +# example config file for ez-ipupdate
9 +# this file is actually executable!
13 +user=loginname:password
14 +host=www.yourdomain.com
17 +# please ensure the user has permission to write this file
18 +cache-file=/tmp/ez-ipupdate.cache
21 +# uncomment this once you have everything working how you want and you are
22 +# ready to have ez-ipupdate running in the background all the time. to stop it
23 +# you can use "killall -QUIT ez-ipupdate" under linux.
25 diff -Naur ez-ipupdate-3.0.11b8-patched/ez-ipupdate.c ez-ipupdate-3.0.11b8-dnsexit/ez-ipupdate.c
26 --- ez-ipupdate-3.0.11b8-patched/ez-ipupdate.c 2005-12-23 01:33:54.000000000 +0000
27 +++ ez-ipupdate-3.0.11b8-dnsexit/ez-ipupdate.c 2005-12-23 02:51:19.000000000 +0000
29 #define HEIPV6TB_DEFAULT_PORT "80"
30 #define HEIPV6TB_REQUEST "/index.cgi"
32 +#define DNSEXIT_DEFAULT_SERVER "www.dnsexit.com"
33 +#define DNSEXIT_DEFAULT_PORT "80"
34 +#define DNSEXIT_REQUEST "/RemoteUpdate.sv"
36 #define DEFAULT_TIMEOUT 120
37 #define DEFAULT_UPDATE_PERIOD 120
38 #define DEFAULT_RESOLV_PERIOD 30
40 int HEIPV6TB_check_info(void);
41 static char *HEIPV6TB_fields_used[] = { "server", "user", NULL };
43 +int DNSEXIT_update_entry(void);
44 +int DNSEXIT_check_info(void);
45 +static char *DNSEXIT_fields_used[] = { "server", "user", "address", "wildcard", "mx", "host", NULL };
48 struct service_t services[] = {
50 { "null", "NULL", 0, },
52 HEIPV6TB_DEFAULT_PORT,
56 + { "dnsexit", 0, 0, },
58 + DNSEXIT_update_entry,
60 + DNSEXIT_fields_used,
61 + DNSEXIT_DEFAULT_SERVER,
62 + DNSEXIT_DEFAULT_PORT,
67 static struct service_t *service = NULL;
68 @@ -4251,6 +4270,195 @@
72 +int DNSEXIT_check_info(void)
76 + if((host == NULL) || (*host == '\0'))
78 + if(options & OPT_DAEMON)
82 + if(host) { free(host); }
85 + fgets(buf, BUFSIZ, stdin);
90 + if(interface == NULL && address == NULL)
92 + if(options & OPT_DAEMON)
94 + fprintf(stderr, "you must provide either an interface or an address\n");
97 + if(interface) { free(interface); }
98 + printf("interface: ");
100 + fgets(buf, BUFSIZ, stdin);
102 + option_handler(CMD_interface, buf);
105 + warn_fields(service->fields_used);
110 +int DNSEXIT_update_entry(void)
112 + char buf[BUFFER_SIZE+1];
118 + buf[BUFFER_SIZE] = '\0';
120 + if(do_connect((int*)&client_sockfd, server, port) != 0)
122 + if(!(options & OPT_QUIET))
124 + show_message("error connecting to %s:%s\n", server, port);
126 + return(UPDATERES_ERROR);
129 + snprintf(buf, BUFFER_SIZE, "GET %s?action=edit&", request);
131 + if(address != NULL && *address != '\0')
133 + snprintf(buf, BUFFER_SIZE, "%s=%s&", "myip", address);
136 + snprintf(buf, BUFFER_SIZE, "%s=%s&", "wildcard", wildcard ? "ON" : "OFF");
138 + snprintf(buf, BUFFER_SIZE, "%s=%s&", "mx", mx);
140 + snprintf(buf, BUFFER_SIZE, "%s=%s&", "backmx", *mx == '\0' ? "NO" : "YES");
142 + snprintf(buf, BUFFER_SIZE, "%s=%s&", "host", host);
144 + snprintf(buf, BUFFER_SIZE, "%s=%s&", "login", user_name);
146 + snprintf(buf, BUFFER_SIZE, "%s=%s&", "password", password);
148 + snprintf(buf, BUFFER_SIZE, " HTTP/1.0\015\012");
150 + snprintf(buf, BUFFER_SIZE, "Authorization: Basic %s\015\012", auth);
152 + snprintf(buf, BUFFER_SIZE, "User-Agent: %s-%s %s [%s] (%s)\015\012",
153 + "ez-update", VERSION, OS, (options & OPT_DAEMON) ? "daemon" : "", "by Angus Mackay");
155 + snprintf(buf, BUFFER_SIZE, "Host: %s\015\012", server);
157 + snprintf(buf, BUFFER_SIZE, "\015\012");
163 + while((bytes=read_input(bp, BUFFER_SIZE-btot)) > 0)
167 + dprintf((stderr, "btot: %d\n", btot));
169 + close(client_sockfd);
172 + dprintf((stderr, "server output: %s\n", buf));
174 + if(sscanf(buf, " HTTP/1.%*c %3d", &ret) != 1)
182 + if(!(options & OPT_QUIET))
184 + show_message("strange server response, are you connecting to the right server?\n");
186 + return(UPDATERES_ERROR);
191 + if(strstr(buf, "0=Success") != NULL)
193 + if(!(options & OPT_QUIET))
195 + printf("Request successful\n");
198 + else if(strstr(buf, "1=IP is the same as the IP on the system") != NULL)
200 + if(!(options & OPT_QUIET))
202 + printf("Request successful but the IP is the same as previous update\n");
205 + else if(strstr(buf, "2=Invalid passwords") != NULL)
207 + if(!(options & OPT_QUIET))
209 + printf("Invalid Password\n");
212 + else if(strstr(buf, "3=User not found") != NULL)
214 + if(!(options & OPT_QUIET))
216 + printf("Username not found\n");
219 + else if(strstr(buf, "4=Update too often") != NULL)
221 + if(!(options & OPT_QUIET))
223 + printf("Updatting too often\n");
228 + show_message("Errors return from server\n");
229 + if(!(options & OPT_QUIET))
231 + fprintf(stderr, "server output: %s\n", buf);
233 + return(UPDATERES_ERROR);
238 + if(!(options & OPT_QUIET))
240 + show_message("authentication failure\n");
242 + return(UPDATERES_SHUTDOWN);
246 + if(!(options & OPT_QUIET))
248 + // reuse the auth buffer
250 + sscanf(buf, " HTTP/1.%*c %*3d %255[^\r\n]", auth);
251 + show_message("unknown return code: %d\n", ret);
252 + show_message("server response: %s\n", auth);
254 + return(UPDATERES_ERROR);
258 + return(UPDATERES_OK);
261 static int is_in_list(char *needle, char **haystack)