2009-03-29 20:48:55 +00:00
|
|
|
diff -ur ez-ipupdate-3.0.11b8.orig/ez-ipupdate.c ez-ipupdate-3.0.11b8/ez-ipupdate.c
|
|
|
|
--- ez-ipupdate-3.0.11b8.orig/ez-ipupdate.c 2009-03-29 22:37:09.000000000 +0200
|
|
|
|
+++ ez-ipupdate-3.0.11b8/ez-ipupdate.c 2009-03-29 22:37:20.000000000 +0200
|
2006-10-09 14:01:12 +00:00
|
|
|
@@ -103,6 +103,11 @@
|
|
|
|
#define HEIPV6TB_DEFAULT_PORT "80"
|
|
|
|
#define HEIPV6TB_REQUEST "/index.cgi"
|
|
|
|
|
|
|
|
+#define EVERYDNS_DEFAULT_SERVER "dyn.everydns.net"
|
|
|
|
+#define EVERYDNS_DEFAULT_PORT "80"
|
|
|
|
+#define EVERYDNS_REQUEST "/index.php"
|
|
|
|
+#define EVERYDNS_VERSION "0.1"
|
|
|
|
+
|
|
|
|
#define DEFAULT_TIMEOUT 120
|
|
|
|
#define DEFAULT_UPDATE_PERIOD 120
|
|
|
|
#define DEFAULT_RESOLV_PERIOD 30
|
2009-03-29 20:48:55 +00:00
|
|
|
@@ -344,6 +349,10 @@
|
2006-10-09 14:01:12 +00:00
|
|
|
int HEIPV6TB_check_info(void);
|
|
|
|
static char *HEIPV6TB_fields_used[] = { "server", "user", NULL };
|
|
|
|
|
|
|
|
+int EVERYDNS_update_entry(void);
|
|
|
|
+int EVERYDNS_check_info(void);
|
|
|
|
+static char *EVERYDNS_fields_used[] = { "server", "user", "host", "address", NULL };
|
|
|
|
+
|
|
|
|
struct service_t services[] = {
|
|
|
|
{ "NULL",
|
|
|
|
{ "null", "NULL", 0, },
|
2009-03-29 20:48:55 +00:00
|
|
|
@@ -517,6 +526,16 @@
|
2006-10-09 14:01:12 +00:00
|
|
|
HEIPV6TB_DEFAULT_PORT,
|
|
|
|
HEIPV6TB_REQUEST
|
|
|
|
},
|
|
|
|
+ { "everydns",
|
|
|
|
+ { "everydns", 0, 0, },
|
|
|
|
+ NULL,
|
|
|
|
+ EVERYDNS_update_entry,
|
|
|
|
+ EVERYDNS_check_info,
|
|
|
|
+ EVERYDNS_fields_used,
|
|
|
|
+ EVERYDNS_DEFAULT_SERVER,
|
|
|
|
+ EVERYDNS_DEFAULT_PORT,
|
|
|
|
+ EVERYDNS_REQUEST
|
|
|
|
+ },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct service_t *service = NULL;
|
2009-03-29 20:48:55 +00:00
|
|
|
@@ -4251,6 +4270,165 @@
|
2006-10-09 14:01:12 +00:00
|
|
|
return(UPDATERES_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
+int EVERYDNS_check_info(void)
|
|
|
|
+{
|
|
|
|
+ warn_fields(service->fields_used);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int EVERYDNS_update_entry(void)
|
|
|
|
+{
|
|
|
|
+ char buf[BUFFER_SIZE+1];
|
|
|
|
+ char *bp = buf;
|
|
|
|
+ int bytes;
|
|
|
|
+ int btot;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ buf[BUFFER_SIZE] = '\0';
|
|
|
|
+
|
|
|
|
+ if(do_connect((int*)&client_sockfd, server, port) != 0)
|
|
|
|
+ {
|
|
|
|
+ if(!(options & OPT_QUIET))
|
|
|
|
+ {
|
|
|
|
+ show_message("error connecting to %s:%s\n", server, port);
|
|
|
|
+ }
|
|
|
|
+ return(UPDATERES_ERROR);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ snprintf(buf, BUFFER_SIZE, "GET %s?ver=%s&", request, EVERYDNS_VERSION);
|
|
|
|
+ output(buf);
|
|
|
|
+ if(address)
|
|
|
|
+ {
|
|
|
|
+ snprintf(buf, BUFFER_SIZE, "%s=%s&", "ip", address);
|
|
|
|
+ output(buf);
|
|
|
|
+ }
|
|
|
|
+ if((host != NULL) && (*host == '\0'))
|
|
|
|
+ {
|
|
|
|
+ snprintf(buf, BUFFER_SIZE, "%s=%s&", "domain", host);
|
|
|
|
+ output(buf);
|
|
|
|
+ }
|
|
|
|
+ snprintf(buf, BUFFER_SIZE, " HTTP/1.0\015\012");
|
|
|
|
+ output(buf);
|
|
|
|
+ snprintf(buf, BUFFER_SIZE, "Authorization: Basic %s\015\012", auth);
|
|
|
|
+ output(buf);
|
|
|
|
+ snprintf(buf, BUFFER_SIZE, "User-Agent: %s-%s %s [%s] (%s)\015\012",
|
|
|
|
+ "ez-update", VERSION, OS, (options & OPT_DAEMON) ? "daemon" : "", "by Angus Mackay");
|
|
|
|
+ output(buf);
|
|
|
|
+ snprintf(buf, BUFFER_SIZE, "Host: %s\015\012", server);
|
|
|
|
+ output(buf);
|
|
|
|
+ snprintf(buf, BUFFER_SIZE, "\015\012");
|
|
|
|
+ output(buf);
|
|
|
|
+
|
|
|
|
+ bp = buf;
|
|
|
|
+ bytes = 0;
|
|
|
|
+ btot = 0;
|
|
|
|
+ while((bytes=read_input(bp, BUFFER_SIZE-btot)) > 0)
|
|
|
|
+ {
|
|
|
|
+ bp += bytes;
|
|
|
|
+ btot += bytes;
|
|
|
|
+ dprintf((stderr, "btot: %d\n", btot));
|
|
|
|
+ }
|
|
|
|
+ close(client_sockfd);
|
|
|
|
+ buf[btot] = '\0';
|
|
|
|
+
|
|
|
|
+ dprintf((stderr, "server output: %s\n", buf));
|
|
|
|
+
|
|
|
|
+ if(sscanf(buf, " HTTP/1.%*c %3d", &ret) != 1)
|
|
|
|
+ {
|
|
|
|
+ ret = -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ switch(ret)
|
|
|
|
+ {
|
|
|
|
+ char *p;
|
|
|
|
+
|
|
|
|
+ case -1:
|
|
|
|
+ if(!(options & OPT_QUIET))
|
|
|
|
+ {
|
|
|
|
+ show_message("strange server response, are you connecting to the right server?\n");
|
|
|
|
+ }
|
|
|
|
+ return(UPDATERES_ERROR);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 200:
|
|
|
|
+ ret = -1;
|
|
|
|
+ if((p=strstr(buf, "Exit code: ")) != NULL)
|
|
|
|
+ {
|
|
|
|
+ sscanf(p, "Exit code: %d", &ret);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * 0 - Successfully Updated
|
|
|
|
+ */
|
|
|
|
+ switch(ret)
|
|
|
|
+ {
|
|
|
|
+ case -1:
|
|
|
|
+ if(!(options & OPT_QUIET))
|
|
|
|
+ {
|
|
|
|
+ show_message("strange server response, are you connecting to the right server?\n");
|
|
|
|
+ }
|
|
|
|
+ return(UPDATERES_ERROR);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 0:
|
|
|
|
+ if(!(options & OPT_QUIET))
|
|
|
|
+ {
|
|
|
|
+ printf("request successful\n");
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 2:
|
|
|
|
+ if(!(options & OPT_QUIET))
|
|
|
|
+ {
|
|
|
|
+ show_message("Bad Username/password\n");
|
|
|
|
+ }
|
|
|
|
+ return(UPDATERES_SHUTDOWN);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 5:
|
|
|
|
+ if(!(options & OPT_QUIET))
|
|
|
|
+ {
|
|
|
|
+ show_message("Last update too recent, please wait...\n");
|
|
|
|
+ }
|
|
|
|
+ return(UPDATERES_ERROR);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ default:
|
|
|
|
+ if(!(options & OPT_QUIET))
|
|
|
|
+ {
|
|
|
|
+ show_message("unknown return code: %d\n", ret);
|
|
|
|
+ fprintf(stderr, "server response: %s\n", buf);
|
|
|
|
+ }
|
|
|
|
+ return(UPDATERES_ERROR);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 401:
|
|
|
|
+ if(!(options & OPT_QUIET))
|
|
|
|
+ {
|
|
|
|
+ show_message("authentication failure\n");
|
|
|
|
+ }
|
|
|
|
+ return(UPDATERES_SHUTDOWN);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ default:
|
|
|
|
+ if(!(options & OPT_QUIET))
|
|
|
|
+ {
|
|
|
|
+ // reuse the auth buffer
|
|
|
|
+ *auth = '\0';
|
|
|
|
+ sscanf(buf, " HTTP/1.%*c %*3d %255[^\r\n]", auth);
|
|
|
|
+ show_message("unknown return code: %d\n", ret);
|
|
|
|
+ fprintf(stderr, "server response: %s\n", auth);
|
|
|
|
+ }
|
|
|
|
+ return(UPDATERES_ERROR);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return(UPDATERES_OK);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static int is_in_list(char *needle, char **haystack)
|
|
|
|
{
|
|
|
|
char **p;
|