update to 2.0.9

This commit is contained in:
wilfried 2003-05-07 08:33:19 +00:00
parent cdd0293384
commit 860b3e1cbc
9 changed files with 159 additions and 178 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.2 2002/09/17 15:22:26 wilfried Exp $
# $OpenBSD: Makefile,v 1.3 2003/05/07 08:33:19 wilfried Exp $
COMMENT= "No-IP.com Dynamic DNS client"
DISTNAME= noip_updater_v1.6
PKGNAME= no-ip-1.6
V= 2.0.9
DISTNAME= noip-${V}
PKGNAME= no-ip-${V}
CATEGORIES= net
HOMEPAGE= http://www.no-ip.com/
@ -22,13 +23,10 @@ MAKE_ENV= SYSCONFDIR="${SYSCONFDIR}"
NO_REGRESS= Yes
ALL_TARGET= noip
ALL_TARGET= noip2
do-install:
${INSTALL_PROGRAM} ${WRKBUILD}/noip ${PREFIX}/sbin
${INSTALL_SCRIPT} ${WRKSRC}/no-ip.sh ${PREFIX}/sbin/no-ip
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/no-ip/
${INSTALL_DATA} ${WRKSRC}/no-ip.conf.sample ${PREFIX}/share/examples/no-ip/
${INSTALL_PROGRAM} ${WRKBUILD}/noip2 ${PREFIX}/sbin
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/no-ip/
${INSTALL_DATA} ${WRKSRC}/README.FIRST ${PREFIX}/share/doc/no-ip/

View File

@ -1,3 +1,3 @@
MD5 (noip_updater_v1.6.tar.gz) = 6503e2e7d8ea35c304744a318b400a09
RMD160 (noip_updater_v1.6.tar.gz) = 11a1bfd48793da703b3601d3937402cd357ff186
SHA1 (noip_updater_v1.6.tar.gz) = 60bea63cfe0996d900b44fe21992bcb214dd7a3d
MD5 (noip-2.0.9.tar.gz) = b58c840661ec4b38742715442435140f
RMD160 (noip-2.0.9.tar.gz) = 8bda3390b891b3d3a282b9dfc561d9fd4da2ee29
SHA1 (noip-2.0.9.tar.gz) = 1c16405bfa6dccb96e5d3560376c13ee7da0ea57

View File

@ -1,20 +1,25 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2002/03/08 16:56:10 wilfried Exp $
--- Makefile.orig Thu Oct 11 01:35:12 2001
+++ Makefile Thu Mar 7 18:15:47 2002
@@ -1,7 +1,5 @@
TGT=noip
$OpenBSD: patch-Makefile,v 1.2 2003/05/07 08:33:19 wilfried Exp $
--- Makefile.orig Fri Jan 17 00:33:22 2003
+++ Makefile Tue Apr 1 17:05:23 2003
@@ -1,5 +1,4 @@
TGT=noip2
-CC=gcc
-
PREFIX=/usr/local
CONFDIR=${PREFIX}/etc
@@ -7,14 +6,13 @@ BINDIR=${PREFIX}/bin
# these defines are for linux and BSD
LIBS=
ARCH=linux
@@ -11,7 +9,7 @@ ARCH=linux
-ARCH=linux
# for solaris, uncomment the next two lines
# LIBS=-lsocket -lnsl
# ARCH=sun
${TGT}: noip.c
- ${CC} -O2 -g -D${ARCH} noip.c -o noip ${LIBS}
+ ${CC} ${CFLAGS} -DSYSCONFDIR=\"${SYSCONFDIR}\" -D${ARCH} noip.c -o noip ${LIBS}
${TGT}: Makefile ${TGT}.c
- ${CC} -Wall -g -O2 -D${ARCH} -DPREFIX=\"${PREFIX}\" ${TGT}.c -o ${TGT} ${LIBS}
+ ${CC} -Wall -g -O2 -DPREFIX=\"${PREFIX}\" ${TGT}.c -o ${TGT} ${LIBS}
conf:
./no-ip.sh
install: ${TGT}
cp ${TGT} ${BINDIR}/${TGT}

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-no-ip_sh,v 1.1.1.1 2002/03/08 16:56:10 wilfried Exp $
--- no-ip.sh.orig Thu Oct 11 01:35:12 2001
+++ no-ip.sh Thu Mar 7 11:28:58 2002
@@ -89,7 +89,7 @@ done
#
if [ "$NAT" = "N" ]
then
- devs=`tail +3 /proc/net/dev | awk -F: '{print $1}' | tr -d ' '|tr '\n' ' '`
+ devs=`ifconfig -a | awk -F: '/flags=/ {print $1}' | tr '\n' ' '`
DEV=foo
while [ "$DEV" = "foo" ]
do

View File

@ -0,0 +1,127 @@
$OpenBSD: patch-noip2_c,v 1.1 2003/05/07 08:33:19 wilfried Exp $
--- noip2.c.orig Sat Mar 8 16:56:04 2003
+++ noip2.c Wed May 7 10:08:59 2003
@@ -93,7 +93,8 @@
#include <sys/ipc.h>
#include <sys/shm.h>
#include <pwd.h>
-
+#include <ifaddrs.h>
+#include <net/if_types.h>
#ifdef linux
#ifndef SIOCGIFADDR
@@ -153,11 +154,8 @@
#define NOGROUP "@@NO_GROUP@@"
#define HOST 1
#define GROUP 2
-#ifndef PREFIX
- #define PREFIX "/usr/local"
-#endif
-#define CONFIG_FILEPATH PREFIX"/etc"
-#define CONFIG_FILENAME PREFIX"/etc/no-ip2.conf"
+#define CONFIG_FILEPATH "/etc"
+#define CONFIG_FILENAME "/etc/no-ip2.conf"
#define CONFSTRLEN 1024
#define MAX_DEVLEN 16
#define MAX_INSTANCE 4
@@ -657,7 +655,7 @@ void save_IP()
void getip(char *p, char *device)
{
int fd;
- int *x;
+ struct sockaddr_in *sin;
struct ifreq ifr;
struct in_addr z;
@@ -684,8 +682,8 @@ void getip(char *p, char *device)
return;
}
close(fd);
- x = (int *)&ifr.ifr_addr; // seems to be off by 2 bytes
- z.s_addr = x[1];
+ sin = (struct sockaddr_in *)&ifr.ifr_addr;
+ z = sin->sin_addr;
strcpy(p, inet_ntoa(z));
#ifdef DEBUG
if (my_instance ? my_instance->debug : debug)
@@ -1376,7 +1374,7 @@ int dynamic_update()
if (my_instance ? my_instance->debug : debug)
Msg("Running %s %s %s", buffer, p, tbuf);
#endif
- execl(buffer, p, tbuf, NULL);
+ execl(buffer, p, tbuf, (void*)0);
Msg("execl %s failed (%s)", buffer, strerror(errno));
exit(0); // bad execute -- don't care!
default: // parent
@@ -1832,45 +1830,36 @@ void get_credentials(char *l, char *p)
/////////////////////////////////////////////////////////////////////////////
int get_all_device_names(unsigned char *devs)
{
-
- int fd, i, devnum=0;
- int num_ifreq;
+ int devnum=0;
unsigned char *p, *q, *dq;
- struct ifreq *pIfr;
- struct ifconf Ifc;
- static struct ifreq IfcBuf[MAX_NET_DEVS];
-
- Ifc.ifc_len = sizeof(IfcBuf);
- Ifc.ifc_buf = (char *) IfcBuf;
-
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- perror("socket()");
- exit(1);
+ struct ifaddrs *ifap, *ifa;
+ if (getifaddrs(&ifap) != 0) {
+ return 0;
}
- if (ioctl(fd, SIOCGIFCONF, &Ifc) < 0) {
- perror("ioctl SIOCGIFCONF");
- exit(1);
- }
- num_ifreq = Ifc.ifc_len / sizeof(struct ifreq);
dq = devs; // add new name into list
- for (pIfr=Ifc.ifc_req,i=0; i<num_ifreq; pIfr++,i++) {
- q = dq; // add new name into list
- p = pIfr->ifr_name;
- if (strcmp("lo", p) == 0)
- continue;
- if (strchr(p, ':') != NULL)
- continue;
- devnum++;
- while (*p)
- *q++ = *p++;
- *q = 0;
- if (devnum >= MAX_NET_DEVS) {
- Msg(CMSG23, MAX_NET_DEVS);
- exit(1);
- }
- dq += LINELEN;
+ for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
+ if (ifa->ifa_addr->sa_family == AF_LINK) {
+ struct if_data *ifd = (struct if_data *) ifa->ifa_data;
+ if (ifd->ifi_type != IFT_ETHER)
+ continue;
+ q = dq; // add new name into list
+ p = ifa->ifa_name;
+ if (strcmp("lo", p) == 0)
+ continue;
+ devnum++;
+ while (*p)
+ *q++ = *p++;
+ *q = 0;
+ if (devnum >= MAX_NET_DEVS) {
+ Msg(CMSG23, MAX_NET_DEVS);
+ exit(1);
+ }
+ dq += LINELEN;
+ }
}
+ freeifaddrs(ifap);
return devnum;
+
}
/////////////////////////////////////////////////////////////////////////////
void get_device_name(char *d)

View File

@ -1,73 +0,0 @@
$OpenBSD: patch-noip_c,v 1.1.1.1 2002/03/08 16:56:10 wilfried Exp $
--- noip.c.orig Thu Oct 11 01:48:12 2001
+++ noip.c Fri Mar 8 17:40:50 2002
@@ -94,9 +94,8 @@
#define CLIENT_IP_PORT 8245
#define OURBUFLEN 8192
#define IPLEN 16
-#define SAVEDIPFILE "/tmp/no-ip_save"
-#define CONFIG_FILENAME "/usr/local/lib/no-ip.conf"
-#define CONFIG_FILENAME_ETC "/usr/local/etc/no-ip.conf"
+#define SAVEDIPFILE "/var/db/no-ip_save"
+#define CONFIG_FILENAME SYSCONFDIR "/no-ip.conf"
#define CONFIGNUM 10
#define CONFSTRLEN 1024
#define NUMBER 2
@@ -224,8 +223,8 @@ void Usage()
#ifdef DEBUG
fprintf(stderr, " -d increase debug verbosity\n");
#endif
- fprintf(stderr, "\n config file is either\n");
- fprintf(stderr, " %s or %s\n", CONFIG_FILENAME,CONFIG_FILENAME_ETC);
+ fprintf(stderr, "\n config file is\n");
+ fprintf(stderr, " %s\n", CONFIG_FILENAME);
fprintf(stderr, " and must contain %d required entries", CONFIGNUM);
fprintf(stderr, " in the form of KEYWORD = value\n");
fprintf(stderr, " A complete description of the config file is in the README file.\n");
@@ -254,12 +253,8 @@ int main(int argc, char *argv[])
program = argv[0];
openlog(program, LOG_PID, LOG_DAEMON);
process_options(argc, argv);
- if (config_filename == NULL) {
- if(!access(CONFIG_FILENAME, R_OK))
- config_filename = CONFIG_FILENAME;
- else
- config_filename = CONFIG_FILENAME_ETC;
- }
+ if (config_filename == NULL)
+ config_filename = CONFIG_FILENAME;
if (handle_config_error(parse_config()) != SUCCESS)
return -1;
if (*groupname)
@@ -375,7 +370,7 @@ void save_IP(int sig)
void getip(char *p)
{
int fd;
- int *x;
+ struct sockaddr_in *sin;
struct ifreq ifr;
struct in_addr z;
@@ -402,8 +397,8 @@ void getip(char *p)
return;
}
close(fd);
- x = (int *)&ifr.ifr_addr; // seems to be off by 2 bytes
- z.s_addr = x[1];
+ sin = (struct sockaddr_in *)&ifr.ifr_addr;
+ z = sin->sin_addr;
strcpy(p, inet_ntoa(z));
sprintf(suppliedIP, "&ip=%s", p); // force sending local address
#ifdef DEBUG
@@ -439,9 +434,9 @@ int run_as_background()
fclose(fildes);
}
if (fp != NULL)
- strncpy(Last_IP_Addr, buffer, IPLEN);
+ strlcpy(Last_IP_Addr, buffer, IPLEN);
else
- memset(Last_IP_Addr, 1, IPLEN); // bogus address at start
+ memset(Last_IP_Addr, 0, IPLEN); // bogus address at start
unlink(SAVEDIPFILE);
while (background) {
delay = MAX(60, interval * 60);

View File

@ -1,10 +1,10 @@
#!/bin/sh
# $OpenBSD: DEINSTALL,v 1.1.1.1 2002/03/08 16:56:10 wilfried Exp $
# $OpenBSD: DEINSTALL,v 1.2 2003/05/07 08:33:19 wilfried Exp $
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
CONFIG_FILE=${SYSCONFDIR}/no-ip.conf
CONFIG_FILE=${SYSCONFDIR}/no-ip2.conf
if [ -f $CONFIG_FILE ]; then
echo

View File

@ -1,61 +0,0 @@
#!/bin/sh
# $OpenBSD: INSTALL,v 1.2 2002/04/26 03:35:34 pvalchev Exp $
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
CONFIG_FILE=${SYSCONFDIR}/no-ip.conf
SAMPLE_CONFIG_FILE=$PREFIX/share/examples/no-ip/no-ip.conf.sample
do_notice()
{
echo
echo "+---------------"
echo "| The existing $1 configuration file, $CONFIG_FILE,"
echo "| has NOT been changed. You may want to compare it to the"
echo "| current sample file, $SAMPLE_CONFIG_FILE,"
echo "| and update your configuration as needed."
echo "+---------------"
echo
}
do_install()
{
install -o root -g wheel -m 600 $SAMPLE_CONFIG_FILE $CONFIG_FILE
echo
echo "+---------------"
echo "| The $1 configuration file, $CONFIG_FILE,"
echo "| has been installed. Please view this file and change"
echo "| the configuration to meet your needs."
echo "+---------------"
echo
}
# verify proper execution
#
if [ $# -ne 2 ]; then
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
fi
# Verify/process the command
#
case $2 in
PRE-INSTALL)
: nothing to pre-install for this port
;;
POST-INSTALL)
if [ -f $CONFIG_FILE ]; then
do_notice $1
else
do_install $1
fi
;;
*)
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
;;
esac
exit 0

View File

@ -1,7 +1,4 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2002/03/08 16:56:10 wilfried Exp $
sbin/no-ip
sbin/noip
@comment $OpenBSD: PLIST,v 1.2 2003/05/07 08:33:19 wilfried Exp $
sbin/noip2
share/doc/no-ip/README.FIRST
share/examples/no-ip/no-ip.conf.sample
@dirrm share/examples/no-ip
@dirrm share/doc/no-ip