3322 动态域名更新 IP 程序补丁

13 篇文章 0 订阅
因为使用的是动态 IP,远程访问比较麻烦,所以一般会申请一个 3322 的动态域名,然后通过更新域名对应的 IP 来实现域名访问远程主机的目的。

在 linux 下,3322 的网站提供了用 lynx 来更新 IP 的命令。但是不知从何时开始,这命令已经不好使了。输出的错误如下:

  1. $lynx -mime_header -auth=xxxx : xxxx "http://www.3322.org/dyndns/update?system=dyndns&hostname=xxxx.3322.org"
  2. Can't Access `file://localhost/home/xxxx/:'
  3. Alert!: Unable to access document.
  4. lynx: Can't access startfile
  5. Can't Access `file://localhost/home/xxxx/:'
  6. Alert!: Unable to access document.
  7. Can't Access `file://localhost/home/xxxx/xxxx'
  8. Alert!: Unable to access document.
  9. lynx: Can't access startfile
  10. lynx: Username and Password required!!!
  11. Can't Access `file://localhost/home/xxxx/:'
  12. Alert!: Unable to access document.
  13. Can't Access `file://localhost/home/xxxx/xxxx'
  14. Alert!: Unable to access document.
  15. Looking up www.3322.org
  16. Making HTTP connection to www.3322.org
  17. Sending HTTP request.
  18. HTTP request sent; waiting for response.
  19. Alert!: Access without authorization denied -- retrying
  20. Retrying with access authorization information.
  21. Looking up www.3322.org
  22. Making HTTP connection to www.3322.org
  23. Sending HTTP request.
  24. HTTP request sent; waiting for response.
  25. Alert!: Can't retry with authorization!  Contact the server's WebMaster.
  26. Can't Access `http://www.3322.org/dyndns/update?system=dyndns&hostname=xxxx.3322.org'
  27. Alert!: Unable to access document.
  28. lynx: Can't access startfile
后发现原因: 户名和密码之间的空格是不需要的,被误导了,唉。。。

修正后,结果正常。

  1. HTTP/1.1 200 OK
  2. Server: nginx
  3. Date: Sat, 13 Dec 2008 11:29:48 GMT
  4. Content-Type: text/plain; charset=GBK
  5. Connection: close
  6. good xxx.xxx.xx.xx

不过,还是看看 3322 提供的 linux 版客户端吧。

先看 binary 版本: http://www.3322.org/download/ez-ipupdate-3.0.10-linux-i386.tgz
  1. $ ./ez-ipupdate
  2. ./ez-ipupdate: relocation error: ./ez-ipupdate: symbol errno, version
  3.  GLIBC_2.0 not defined in file libc.so.6 with link time reference

看看 libc.so.6 的版本:
  1. $ /lib/libc.so.6
  2. GNU C Library stable release version 2.7, by Roland McGrath et al.
  3. Copyright (C) 2007 Free Software Foundation, Inc.
  4. This is free software; see the source for copying conditions.
  5. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
  6. PARTICULAR PURPOSE.
  7. Compiled by GNU CC version 4.2.4 (Ubuntu 4.2.4-1ubuntu1).
  8. Compiled on a Linux >>2.6.24-16-server<< system on 2008-09-12.
  9. Available extensions:
  10.         crypt add-on version 2.1 by Michael Glad and others
  11.         GNU Libidn by Simon Josefsson
  12.         Native POSIX Threads Library by Ulrich Drepper et al
  13.         BIND-8.2.3-T5B
  14. For bug reporting instructions, please see:
  15. <http://www.gnu.org/software/libc/bugs.html>.
没法用了,用源码编译吧。

源码版本:http://www.3322.org/download/ez-ipupdate-3.0.10.tgz

make 的时候出错:
  1. gcc  -g -O2  -o ez-ipupdate  ez-ipupdate.o conf_file.o md5.o cache_file.o pid_file.o
  2. /usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference in conf_file.o
  3. /lib/libc.so.6: could not read symbols: Bad value
  4. collect2: ld returned 1 exit status
  5. make: *** [ez-ipupdate] Error 1

主要是 extern int errno; 惹的祸,patch 之。

  1. diff -uNr ez-ipupdate-3.0.10/conf_file.c ez-ipupdate-3.0.10_diff/conf_file.c
  2. --- ez-ipupdate-3.0.10/conf_file.c  2000-10-23 10:36:18.000000000 +0800
  3. +++ ez-ipupdate-3.0.10_diff/conf_file.c 2008-12-12 23:32:53.000000000 +0800
  4. @@ -36,13 +36,14 @@
  5.  #include <string.h>
  6.  #include <conf_file.h>
  7. +#include <errno.h>
  8.  #if HAVE_STRERROR
  9. -extern int errno;
  10. +//extern int errno;
  11.  #  define error_string strerror(errno)
  12.  #elif HAVE_SYS_ERRLIST
  13.  extern const char *const sys_errlist[];
  14. -extern int errno;
  15. +//extern int errno;
  16.  #  define error_string (sys_errlist[errno])
  17.  #else
  18.  #  define error_string "error message not found"
  19. diff -uNr ez-ipupdate-3.0.10/error.h ez-ipupdate-3.0.10_diff/error.h
  20. --- ez-ipupdate-3.0.10/error.h  2000-11-25 06:46:37.000000000 +0800
  21. +++ ez-ipupdate-3.0.10_diff/error.h 2008-12-12 23:31:59.000000000 +0800
  22. @@ -1,12 +1,14 @@
  23.  #ifndef _ERROR_H
  24.  #define _ERROR_H
  25. +#include <errno.h>
  26. +
  27.  #if HAVE_STRERROR
  28. -extern int errno;
  29. +//extern int errno;
  30.  #  define error_string strerror(errno)
  31.  #elif HAVE_SYS_ERRLIST
  32.  extern const char *const sys_errlist[];
  33. -extern int errno;
  34. +//extern int errno;
  35.  #  define error_string (sys_errlist[errno])
  36.  #else
  37.  #  define error_string "error message not found"

现在 patch 完成,ez-ipupdate 可以工作了。
  1. $ ./ez-ipupdate -c qdns.conf
  2. ez-ipupdate Version 3.0.10
  3. Copyright (C) 1999-2000 Angus Mackay.
  4. no update needed at this time
IP 都没改变,不用更新了。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值