Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Backports:SLE-15-SP4:FactoryCandidates
ez-ipupdate
ez-ipupdate-joker_com.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ez-ipupdate-joker_com.patch of Package ez-ipupdate
From: Philipp Thomas <pth@suse.de> Date: 2013-04-10 17:53:34+02:00 Subject: Add support for joker.com Add support for the dyndns service of joker.com. --- ez-ipupdate.c | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) signed-off-by: pth@suse.de Index: ez-ipupdate.c =================================================================== --- ez-ipupdate.c.orig 2013-04-11 10:50:22.180672887 +0200 +++ ez-ipupdate.c 2013-04-11 10:54:02.685445947 +0200 @@ -107,6 +107,10 @@ #define DNSEXIT_DEFAULT_PORT "80" #define DNSEXIT_REQUEST "/RemoteUpdate.sv" +#define JOKER_DEFAULT_SERVER "svc.joker.com" +#define JOKER_DEFAULT_PORT "80" +#define JOKER_REQUEST "/nic/update" + #define DEFAULT_TIMEOUT 120 #define DEFAULT_UPDATE_PERIOD 120 #define DEFAULT_RESOLV_PERIOD 30 @@ -353,6 +357,10 @@ int DNSEXIT_check_info(void); static char *DNSEXIT_fields_used[] = { "server", "user", "address", "wildcard", "mx", "host", NULL }; #endif +int JOKER_update_entry(void); +int JOKER_check_info(void); +static char *JOKER_fields_used[] = { "server", "user", "address", "wildcard", "mx", "host", NULL }; + struct service_t services[] = { { "NULL", { "null", "NULL", 0, }, @@ -538,6 +546,16 @@ struct service_t services[] = { DNSEXIT_REQUEST }, #endif + { "joker", + { "joker", 0, 0, }, + NULL, + JOKER_update_entry, + JOKER_check_info, + JOKER_fields_used, + JOKER_DEFAULT_SERVER, + JOKER_DEFAULT_PORT, + JOKER_REQUEST + }, }; static struct service_t *service = NULL; @@ -4265,6 +4283,180 @@ int HEIPV6TB_update_entry(void) } return(UPDATERES_ERROR); break; + } + + return(UPDATERES_OK); +} + +int JOKER_check_info(void) +{ + char buf[BUFSIZ+1]; + + if((host == NULL) || (*host == '\0')) + { + if(options & OPT_DAEMON) + { + return(-1); + } + if(host) { free(host); } + printf("host: "); + *buf = '\0'; + fgets(buf, BUFSIZ, stdin); + host = strdup(buf); + chomp(host); + } + + if(interface == NULL && address == NULL) + { + if(options & OPT_DAEMON) + { + fprintf(stderr, "you must provide either an interface or an address\n"); + return(-1); + } + if(interface) { free(interface); } + printf("interface: "); + *buf = '\0'; + fgets(buf, BUFSIZ, stdin); + chomp(buf); + option_handler(CMD_interface, buf); + } + + warn_fields(service->fields_used); + + return 0; +} + +int JOKER_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?", request); + output(buf); + snprintf(buf, BUFFER_SIZE, "%s=%s&", "username", user_name); + output(buf); + snprintf(buf, BUFFER_SIZE, "%s=%s&", "password", password); + output(buf); + snprintf(buf, BUFFER_SIZE, "%s=%s&", "hostname", host); + output(buf); + snprintf(buf, BUFFER_SIZE, "%s=%s&", "myip", address); + output(buf); + snprintf(buf, BUFFER_SIZE, "%s=%s&", "wildcard", wildcard ? "yes" : "no"); + output(buf); + snprintf(buf, BUFFER_SIZE, "%s=%s&", "mx", mx); + output(buf); + snprintf(buf, BUFFER_SIZE, "%s=%s&", "backmx", *mx == '\0' ? "NO" : "YES"); + output(buf); + snprintf(buf, BUFFER_SIZE, " HTTP/1.0\015\012"); + 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) + { + 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: + if(!(options & OPT_QUIET)) + { + printf("request successful\n"); + } + break; + + case 302: + // There is no neat way to determine the exact error other than to + // parse the Location part of the mime header to find where we're + // being redirected. + if(!(options & OPT_QUIET)) + { + // reuse the auth buffer + *auth = '\0'; + bp = strstr(buf, "Location: "); + if((bp < strstr(buf, "\r\n\r\n")) && (sscanf(bp, "Location: http://%*[^/]%255[^\r\n]", auth) == 1)) + { + bp = strrchr(auth, '/') + 1; + } + else + { + bp = ""; + } + dprintf((stderr, "location: %s\n", bp)); + + if(!(strncmp(bp, "domainmismatch.htm", strlen(bp)) && strncmp(bp, "invname.htm", strlen(bp)))) + { + show_message("invalid host name\n"); + } + else if(!strncmp(bp, "invkey.htm", strlen(bp))) + { + show_message("invalid password(tzo key)\n"); + } + else if(!(strncmp(bp, "emailmismatch.htm", strlen(bp)) && strncmp(bp, "invemail.htm", strlen(bp)))) + { + show_message("invalid user name(email address)\n"); + } + else + { + show_message("unknown error\n"); + } + } + return(UPDATERES_ERROR); + 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); + show_message("server response: %s\n", auth); + } + return(UPDATERES_ERROR); + break; } return(UPDATERES_OK);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor