Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 116439 | Differences between
and this patch

Collapse All | Expand All

(-)ez-ipupdate-3.0.11b8-patched/example-dnsexit.conf (+20 lines)
Line 0 Link Here
1
#!/usr/sbin/ez-ipupdate -c
2
#
3
# example config file for ez-ipupdate
4
#
5
# this file is actually executable!
6
#
7
8
service-type=dnsexit
9
user=loginname:password
10
host=www.yourdomain.com
11
interface=eth0
12
13
# please ensure the user has permission to write this file
14
cache-file=/tmp/ez-ipupdate.cache
15
16
run-as-user=ez-ipupd
17
# uncomment this once you have everything working how you want and you are
18
# ready to have ez-ipupdate running in the background all the time. to stop it
19
# you can use "killall -QUIT ez-ipupdate" under linux.
20
#daemon
(-)ez-ipupdate-3.0.11b8-patched/ez-ipupdate.c (+187 lines)
Lines 103-108 Link Here
103
#define HEIPV6TB_DEFAULT_PORT "80"
103
#define HEIPV6TB_DEFAULT_PORT "80"
104
#define HEIPV6TB_REQUEST "/index.cgi"
104
#define HEIPV6TB_REQUEST "/index.cgi"
105
105
106
#define DNSEXIT_DEFAULT_SERVER "www.dnsexit.com"
107
#define DNSEXIT_DEFAULT_PORT "80"
108
#define DNSEXIT_REQUEST "/RemoteUpdate.sv"
109
106
#define DEFAULT_TIMEOUT 120
110
#define DEFAULT_TIMEOUT 120
107
#define DEFAULT_UPDATE_PERIOD 120
111
#define DEFAULT_UPDATE_PERIOD 120
108
#define DEFAULT_RESOLV_PERIOD 30
112
#define DEFAULT_RESOLV_PERIOD 30
Lines 344-349 Link Here
344
int HEIPV6TB_check_info(void);
348
int HEIPV6TB_check_info(void);
345
static char *HEIPV6TB_fields_used[] = { "server", "user", NULL };
349
static char *HEIPV6TB_fields_used[] = { "server", "user", NULL };
346
350
351
int DNSEXIT_update_entry(void);
352
int DNSEXIT_check_info(void);
353
static char *DNSEXIT_fields_used[] = { "server", "user", "address", "wildcard", "mx", "host", NULL };
354
355
347
struct service_t services[] = {
356
struct service_t services[] = {
348
  { "NULL",
357
  { "NULL",
349
    { "null", "NULL", 0, },
358
    { "null", "NULL", 0, },
Lines 517-522 Link Here
517
    HEIPV6TB_DEFAULT_PORT,
526
    HEIPV6TB_DEFAULT_PORT,
518
    HEIPV6TB_REQUEST
527
    HEIPV6TB_REQUEST
519
  },
528
  },
529
  { "dnsexit",
530
	{ "dnsexit", 0, 0, },
531
	NULL,
532
	DNSEXIT_update_entry,
533
	DNSEXIT_check_info,
534
	DNSEXIT_fields_used,
535
	DNSEXIT_DEFAULT_SERVER,
536
	DNSEXIT_DEFAULT_PORT,
537
	DNSEXIT_REQUEST
538
  },	  
520
};
539
};
521
540
522
static struct service_t *service = NULL;
541
static struct service_t *service = NULL;
Lines 4251-4256 Link Here
4251
  return(UPDATERES_OK);
4270
  return(UPDATERES_OK);
4252
}
4271
}
4253
4272
4273
int DNSEXIT_check_info(void)
4274
{
4275
  char buf[BUFSIZ+1];
4276
4277
  if((host == NULL) || (*host == '\0'))
4278
  {
4279
    if(options & OPT_DAEMON)
4280
    {
4281
      return(-1);
4282
    }
4283
    if(host) { free(host); }
4284
    printf("host: ");
4285
    *buf = '\0';
4286
    fgets(buf, BUFSIZ, stdin);
4287
    host = strdup(buf);
4288
    chomp(host);
4289
  }
4290
4291
  if(interface == NULL && address == NULL)
4292
  {
4293
    if(options & OPT_DAEMON)
4294
    {
4295
      fprintf(stderr, "you must provide either an interface or an address\n");
4296
      return(-1);
4297
    }
4298
    if(interface) { free(interface); }
4299
    printf("interface: ");
4300
    *buf = '\0';
4301
    fgets(buf, BUFSIZ, stdin);
4302
    chomp(buf);
4303
    option_handler(CMD_interface, buf);
4304
  }
4305
4306
  warn_fields(service->fields_used);
4307
4308
  return 0;
4309
}
4310
4311
int DNSEXIT_update_entry(void)
4312
{
4313
  char buf[BUFFER_SIZE+1];
4314
  char *bp = buf;
4315
  int bytes;
4316
  int btot;
4317
  int ret;
4318
4319
  buf[BUFFER_SIZE] = '\0';
4320
4321
  if(do_connect((int*)&client_sockfd, server, port) != 0)
4322
  {
4323
    if(!(options & OPT_QUIET))
4324
    {
4325
      show_message("error connecting to %s:%s\n", server, port);
4326
    }
4327
    return(UPDATERES_ERROR);
4328
  }
4329
4330
  snprintf(buf, BUFFER_SIZE, "GET %s?action=edit&", request);
4331
  output(buf);
4332
  if(address != NULL && *address != '\0')
4333
  {
4334
    snprintf(buf, BUFFER_SIZE, "%s=%s&", "myip", address);
4335
    output(buf);
4336
  }
4337
  snprintf(buf, BUFFER_SIZE, "%s=%s&", "wildcard", wildcard ? "ON" : "OFF");
4338
  output(buf);
4339
  snprintf(buf, BUFFER_SIZE, "%s=%s&", "mx", mx);
4340
  output(buf);
4341
  snprintf(buf, BUFFER_SIZE, "%s=%s&", "backmx", *mx == '\0' ? "NO" : "YES");
4342
  output(buf);
4343
  snprintf(buf, BUFFER_SIZE, "%s=%s&", "host", host);
4344
  output(buf);
4345
  snprintf(buf, BUFFER_SIZE, "%s=%s&", "login", user_name);
4346
  output(buf);
4347
  snprintf(buf, BUFFER_SIZE, "%s=%s&", "password", password);
4348
  output(buf);
4349
  snprintf(buf, BUFFER_SIZE, " HTTP/1.0\015\012");
4350
  output(buf);
4351
  snprintf(buf, BUFFER_SIZE, "Authorization: Basic %s\015\012", auth);
4352
  output(buf);
4353
  snprintf(buf, BUFFER_SIZE, "User-Agent: %s-%s %s [%s] (%s)\015\012",
4354
      "ez-update", VERSION, OS, (options & OPT_DAEMON) ? "daemon" : "", "by Angus Mackay");
4355
  output(buf);
4356
  snprintf(buf, BUFFER_SIZE, "Host: %s\015\012", server);
4357
  output(buf);
4358
  snprintf(buf, BUFFER_SIZE, "\015\012");
4359
  output(buf);
4360
4361
  bp = buf;
4362
  bytes = 0;
4363
  btot = 0;
4364
  while((bytes=read_input(bp, BUFFER_SIZE-btot)) > 0)
4365
  {
4366
    bp += bytes;
4367
    btot += bytes;
4368
    dprintf((stderr, "btot: %d\n", btot));
4369
  }
4370
  close(client_sockfd);
4371
  buf[btot] = '\0';
4372
4373
  dprintf((stderr, "server output: %s\n", buf));
4374
4375
  if(sscanf(buf, " HTTP/1.%*c %3d", &ret) != 1)
4376
  {
4377
    ret = -1;
4378
  }
4379
4380
  switch(ret)
4381
  {
4382
    case -1:
4383
      if(!(options & OPT_QUIET))
4384
      {
4385
        show_message("strange server response, are you connecting to the right server?\n");
4386
      }
4387
      return(UPDATERES_ERROR);
4388
      break;
4389
4390
    case 200:
4391
4392
      if(strstr(buf, "0=Success") != NULL)
4393
      {
4394
        if(!(options & OPT_QUIET))
4395
        {
4396
          printf("Request successful\n");
4397
        }
4398
      }
4399
      else if(strstr(buf, "1=IP stays same") != NULL)
4400
      {
4401
        if(!(options & OPT_QUIET))
4402
        {
4403
          printf("Request successful but the IP is the same as previous update\n");
4404
        }
4405
      }
4406
      else
4407
      {
4408
        show_message("Errors return from server\n");
4409
        if(!(options & OPT_QUIET))
4410
        {
4411
          fprintf(stderr, "server output: %s\n", buf);
4412
        }
4413
        return(UPDATERES_ERROR);
4414
      }
4415
      break;
4416
4417
    case 401:
4418
      if(!(options & OPT_QUIET))
4419
      {
4420
        show_message("authentication failure\n");
4421
      }
4422
      return(UPDATERES_SHUTDOWN);
4423
      break;
4424
4425
    default:
4426
      if(!(options & OPT_QUIET))
4427
      {
4428
        // reuse the auth buffer
4429
        *auth = '\0';
4430
        sscanf(buf, " HTTP/1.%*c %*3d %255[^\r\n]", auth);
4431
        show_message("unknown return code: %d\n", ret);
4432
        show_message("server response: %s\n", auth);
4433
      }
4434
      return(UPDATERES_ERROR);
4435
      break;
4436
  }
4437
4438
  return(UPDATERES_OK);
4439
}
4440
4254
static int is_in_list(char *needle, char **haystack)
4441
static int is_in_list(char *needle, char **haystack)
4255
{
4442
{
4256
  char **p;
4443
  char **p;

Return to bug 116439