[package] update ndyndns to 2.1 (#8732)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@25246 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2011-01-29 22:09:11 +00:00
parent b8b0482937
commit 81b7af0be4
5 changed files with 243 additions and 183 deletions

View File

@ -1,14 +1,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ndyndns
PKG_VERSION:=1.12
PKG_VERSION:=2.1
PKG_RELEASE:=1
PKG_SOURCE:=ndyndns-$(PKG_VERSION).tar.gz
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://ndyndns.googlecode.com/files
PKG_MD5SUM:=1ca356cf366cd617fe3fb5fad9eb961b
PKG_MD5SUM:=0cdb4dcba5f8c1664f53884b3c2179e9
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
PKG_FIXUP = libtool
include $(INCLUDE_DIR)/package.mk

View File

@ -1,4 +1,7 @@
[config]
[dyndns]
username = user
password = password
hostname=hostname.dyndns.org
hosts = hostname.dyndns.org
wildcard

View File

@ -1,14 +1,24 @@
diff --git a/configure b/configure
index 73ac9e1..3d3c187 100755
--- a/configure
+++ b/configure
@@ -3520,8 +3520,7 @@ fi
diff -urN ndyndns-2.1.orig/configure ndyndns-2.1/configure
--- ndyndns-2.1.orig/configure 2010-07-17 13:22:39.000000000 +0200
+++ ndyndns-2.1/configure 2011-01-26 16:24:15.834445729 +0100
@@ -3318,7 +3318,7 @@
fi
-CURLINC=-I`curl-config --prefix`/include
-
+CURLINC=`curl-config --cflags`
+CURLINC=-I`curl-config --cflags`
CURLLIB=`curl-config --libs`
diff -urN ndyndns-2.1.orig/configure.in ndyndns-2.1/configure.in
--- ndyndns-2.1.orig/configure.in 2010-07-17 13:22:11.000000000 +0200
+++ ndyndns-2.1/configure.in 2011-01-26 16:24:14.090441650 +0100
@@ -24,7 +24,7 @@
fi
AC_SUBST(PLATFORM)
-CURLINC=-I`curl-config --prefix`/include
+CURLINC=-I`curl-config --cflags`
AC_SUBST(CURLINC)
CURLLIB=`curl-config --libs`
AC_SUBST(CURLLIB)

View File

@ -0,0 +1,211 @@
diff -urN ndyndns-2.1.orig/cfg.c ndyndns-2.1/cfg.c
--- ndyndns-2.1.orig/cfg.c 2011-01-26 17:02:05.762443700 +0100
+++ ndyndns-2.1/cfg.c 2011-01-26 17:03:43.334443683 +0100
@@ -804,34 +804,6 @@
continue;
}
- tmp = parse_line_string(point, "user");
- if (tmp) {
- switch (prs) {
- default:
- parse_warn(lnum, "user");
- break;
- case PRS_CONFIG:
- cfg_set_user(tmp);
- break;
- }
- free(tmp);
- continue;
- }
-
- tmp = parse_line_string(point, "group");
- if (tmp) {
- switch (prs) {
- default:
- parse_warn(lnum, "group");
- break;
- case PRS_CONFIG:
- cfg_set_group(tmp);
- break;
- }
- free(tmp);
- continue;
- }
-
tmp = parse_line_string(point, "interface");
if (tmp) {
switch (prs) {
diff -urN ndyndns-2.1.orig/chroot.c ndyndns-2.1/chroot.c
--- ndyndns-2.1.orig/chroot.c 2011-01-26 17:02:05.762443700 +0100
+++ ndyndns-2.1/chroot.c 2011-01-26 17:03:54.470442525 +0100
@@ -19,8 +19,6 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
-#include <pwd.h>
-#include <grp.h>
#include "defines.h"
#include "log.h"
@@ -82,32 +80,3 @@
}
}
}
-
-void drop_root(uid_t uid, gid_t gid)
-{
- if (uid == 0 || gid == 0) {
- log_line("FATAL - drop_root: attempt to drop root to root?\n");
- exit(EXIT_FAILURE);
- }
-
- if (getgid() == 0) {
- if (setregid(gid, gid) == -1) {
- log_line("FATAL - drop_root: failed to drop real gid == root!\n");
- exit(EXIT_FAILURE);
- }
- }
-
- if (getuid() == 0) {
- if (setreuid(uid, uid) == -1) {
- log_line("FATAL - drop_root: failed to drop real uid == root!\n");
- exit(EXIT_FAILURE);
- }
- }
-
- /* be absolutely sure */
- if (getgid() == 0 || getuid() == 0) {
- log_line("FATAL - drop_root: tried to drop root, but still have root!\n");
- exit(EXIT_FAILURE);
- }
-}
-
diff -urN ndyndns-2.1.orig/Makefile.in ndyndns-2.1/Makefile.in
--- ndyndns-2.1.orig/Makefile.in 2011-01-26 17:02:05.766443748 +0100
+++ ndyndns-2.1/Makefile.in 2011-01-26 17:03:43.338443633 +0100
@@ -1,11 +1,9 @@
#CC = gcc -Wall -Wpointer-arith -Wstrict-prototypes -pedantic
CC = @CC@
-dnslib = -lnss_dns
objects = log.o nstrl.o util.o chroot.o pidfile.o signals.o strlist.o checkip.o $(PLATFORM).o cfg.o ndyndns.o
-CURLINC = @CURLINC@
CURLLIB = @CURLLIB@
VERSION = @VERSION@
-CFLAGS = @CFLAGS@ -Wall -Wextra -pedantic $(CURLINC)
+CFLAGS += -Wall -Wpointer-arith -Wstrict-prototypes -pedantic
PLATFORM = @PLATFORM@
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -16,7 +14,7 @@
all: ndyndns
ndyndns : $(objects)
- $(CC) $(LDFLAGS) $(dnslib) $(CURLLIB) -o ndyndns $(objects)
+ $(CC) $(LDFLAGS) $(CURLLIB) -o ndyndns $(objects)
ndyndns.o : log.h nstrl.h util.h chroot.h pidfile.h signals.h strlist.h checkip.h $(PLATFORM).h cfg.h
$(CC) $(CFLAGS) -c -o $@ ndyndns.c
diff -urN ndyndns-2.1.orig/ndyndns.c ndyndns-2.1/ndyndns.c
--- ndyndns-2.1.orig/ndyndns.c 2011-01-26 17:02:05.766443748 +0100
+++ ndyndns-2.1/ndyndns.c 2011-01-26 17:04:15.526443092 +0100
@@ -32,8 +32,6 @@
#include <net/if.h>
#include <ctype.h>
#include <time.h>
-#include <pwd.h>
-#include <grp.h>
#include <signal.h>
#include <errno.h>
@@ -897,40 +895,6 @@
strlcpy(pidfile, pidfname, sizeof pidfile);
}
-void cfg_set_user(char *username)
-{
- int t;
- char *p;
- struct passwd *pws;
-
- t = (unsigned int) strtol(username, &p, 10);
- if (*p != '\0') {
- pws = getpwnam(username);
- if (pws) {
- cfg_uid = (int)pws->pw_uid;
- if (!cfg_gid)
- cfg_gid = (int)pws->pw_gid;
- } else suicide("FATAL - Invalid uid specified.\n");
- } else
- cfg_uid = t;
-}
-
-void cfg_set_group(char *groupname)
-{
- int t;
- char *p;
- struct group *grp;
-
- t = (unsigned int) strtol(groupname, &p, 10);
- if (*p != '\0') {
- grp = getgrnam(groupname);
- if (grp) {
- cfg_gid = (int)grp->gr_gid;
- } else suicide("FATAL - Invalid gid specified.\n");
- } else
- cfg_gid = t;
-}
-
void cfg_set_interface(char *interface)
{
strlcpy(ifname, interface, sizeof ifname);
@@ -954,8 +918,6 @@
{"disable-chroot", 0, 0, 'x'},
{"file", 1, 0, 'f'},
{"cfg-stdin", 0, 0, 'F'},
- {"user", 1, 0, 'u'},
- {"group", 1, 0, 'g'},
{"interface", 1, 0, 'i'},
{"remote", 0, 0, 'r'},
{"help", 0, 0, 'h'},
@@ -963,7 +925,7 @@
{0, 0, 0, 0}
};
- c = getopt_long(argc, argv, "rdnp:qc:xf:Fu:g:i:hv", long_options, &option_index);
+ c = getopt_long(argc, argv, "rdnp:qc:xf:i:hv", long_options, &option_index);
if (c == -1) break;
switch (c) {
@@ -983,8 +945,6 @@
" -F, --cfg-stdin read configuration file from standard input\n"
" -p, --pidfile pidfile path\n");
printf(
- " -u, --user user name that ndyndns should run as\n"
- " -g, --group group name that ndyndns should run as\n"
" -i, --interface interface ip to check (default: ppp0)\n"
" -r, --remote get ip from remote dyndns host (overrides -i)\n"
" -h, --help print this help and exit\n"
@@ -1060,14 +1020,6 @@
cfg_set_pidfile(optarg);
break;
- case 'u':
- cfg_set_user(optarg);
- break;
-
- case 'g':
- cfg_set_group(optarg);
- break;
-
case 'i':
cfg_set_interface(optarg);
break;
@@ -1095,7 +1047,6 @@
/* Note that failure cases are handled by called fns. */
imprison(get_chroot());
- drop_root(cfg_uid, cfg_gid);
/* Cover our tracks... */
wipe_chroot();

View File

@ -1,163 +0,0 @@
diff -Naur old/Makefile.in new/Makefile.in
--- old/Makefile.in 2007-09-13 10:56:00.000000000 -0700
+++ new/Makefile.in 2008-02-03 04:07:13.000000000 -0800
@@ -1,11 +1,9 @@
#CC = gcc -Wall -Wpointer-arith -Wstrict-prototypes -pedantic
CC = @CC@
-dnslib = -lnss_dns
objects = log.o nstrl.o util.o chroot.o pidfile.o signals.o strlist.o checkip.o $(PLATFORM).o cfg.o ndyndns.o
-CURLINC = @CURLINC@
CURLLIB = @CURLLIB@
VERSION = @VERSION@
-CFLAGS = @CFLAGS@ -Wall -Wpointer-arith -Wstrict-prototypes -pedantic $(CURLINC)
+CFLAGS += -Wall -Wpointer-arith -Wstrict-prototypes -pedantic
PLATFORM = @PLATFORM@
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -16,7 +14,7 @@
all: ndyndns
ndyndns : $(objects)
- $(CC) $(LDFLAGS) $(dnslib) $(CURLLIB) -o ndyndns $(objects)
+ $(CC) $(LDFLAGS) $(CURLLIB) -o ndyndns $(objects)
ndyndns.o : log.h nstrl.h util.h chroot.h pidfile.h signals.h strlist.h checkip.h $(PLATFORM).h cfg.h
$(CC) $(CFLAGS) -c -o $@ ndyndns.c
diff -Naur old/chroot.c new/chroot.c
--- old/chroot.c 2007-03-13 15:54:12.000000000 -0700
+++ new/chroot.c 2008-02-03 04:10:21.000000000 -0800
@@ -18,8 +18,6 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
-#include <pwd.h>
-#include <grp.h>
#include "defines.h"
#include "log.h"
@@ -60,24 +58,4 @@
log_line("Failed to chdir(%s). Not invoking job.", path);
exit(EXIT_FAILURE);
}
-
- ret = chroot(path);
- if (ret) {
- log_line("Failed to chroot(%s). Not invoking job.", path);
- exit(EXIT_FAILURE);
- }
}
-
-void drop_root(uid_t uid, gid_t gid)
-{
- if (uid == 0 || gid == 0) {
- log_line("FATAL - drop_root: attempt to drop root to root?\n");
- exit(EXIT_FAILURE);
- }
-
- if (setregid(gid, gid) == -1 || setreuid(uid, uid) == -1) {
- log_line("FATAL - drop_root: failed to drop root!\n");
- exit(EXIT_FAILURE);
- }
-}
-
diff -Naur old/ndyndns.c new/ndyndns.c
--- old/ndyndns.c 2007-09-19 00:04:13.000000000 -0700
+++ new/ndyndns.c 2008-02-03 04:10:21.000000000 -0800
@@ -32,8 +32,6 @@
#include <net/if.h>
#include <ctype.h>
#include <time.h>
-#include <pwd.h>
-#include <grp.h>
#include <signal.h>
#include <errno.h>
@@ -728,12 +726,9 @@
}
int main(int argc, char** argv) {
- int c, t, uid = 0, gid = 0;
+ int c, t;
char pidfile[MAX_PATH_LENGTH] = PID_FILE_DEFAULT;
char conffile[MAX_PATH_LENGTH] = CONF_FILE_DEFAULT;
- char *p;
- struct passwd *pws;
- struct group *grp;
while (1) {
@@ -745,8 +740,6 @@
{"quiet", 0, 0, 'q'},
{"chroot", 1, 0, 'c'},
{"file", 1, 0, 'f'},
- {"user", 1, 0, 'u'},
- {"group", 1, 0, 'g'},
{"interface", 1, 0, 'i'},
{"remote", 0, 0, 'r'},
{"help", 0, 0, 'h'},
@@ -754,7 +747,7 @@
{0, 0, 0, 0}
};
- c = getopt_long (argc, argv, "rdnp:qc:f:u:g:i:hv", long_options, &option_index);
+ c = getopt_long (argc, argv, "rdnp:qc:f:i:hv", long_options, &option_index);
if (c == -1) break;
switch (c) {
@@ -771,8 +764,6 @@
" -f, --file configuration file\n"
" -p, --pidfile pidfile path\n");
printf(
-" -u, --user user name that ndyndns should run as\n"
-" -g, --group group name that ndyndns should run as\n"
" -i, --interface interface ip to check (default: ppp0)\n"
" -r, --remote get ip from remote dyndns host (overrides -i)\n"
" -h, --help print this help and exit\n"
@@ -817,39 +808,12 @@
strlcpy(pidfile, optarg, sizeof pidfile);
break;
- case 'u':
- t = (unsigned int) strtol(optarg, &p, 10);
- if (*p != '\0') {
- pws = getpwnam(optarg);
- if (pws) {
- uid = (int)pws->pw_uid;
- if (!gid)
- gid = (int)pws->pw_gid;
- } else suicide("FATAL - Invalid uid specified.\n");
- } else
- uid = t;
- break;
-
- case 'g':
- t = (unsigned int) strtol(optarg, &p, 10);
- if (*p != '\0') {
- grp = getgrnam(optarg);
- if (grp) {
- gid = (int)grp->gr_gid;
- } else suicide("FATAL - Invalid gid specified.\n");
- } else
- gid = t;
- break;
-
case 'i':
strlcpy(ifname, optarg, sizeof ifname);
break;
}
}
- if (getuid())
- suicide("FATAL - I need root for chroot!\n");
-
if (gflags_detach)
if (daemon(0,0))
suicide("FATAL - detaching fork failed\n");
@@ -870,7 +834,6 @@
/* Note that failure cases are handled by called fns. */
imprison(get_chroot());
- drop_root(uid, gid);
/* Cover our tracks... */
wipe_chroot();