1 diff --git Makefile Makefile
2 index 6ee183a..23ef317 100644
11 CFLAGS = -Wall -Wstrict-prototypes -O2 -g
12 @@ -20,31 +21,31 @@ NODEUSERS_OBJS = $(NODEUSERS_SRC:.c=.o)
16 -install: installbin installman installhelp
17 - install -m 755 -o root -g root -d $(VAR_DIR)/node
18 - install -m 644 -o root -g root etc/loggedin $(VAR_DIR)/node
19 +install: installbin installman installhelp installconf
20 + install -m 755 -D -o root -g root -d $(VAR_DIR)/node
21 + install -m 644 -D -o root -g root etc/loggedin $(VAR_DIR)/node
23 @rm -f /usr/bin/nodeusers
26 - install -m 4755 -s -o root -g root node $(SBIN_DIR)
27 - install -m 755 -s -o root -g root nodeusers $(SBIN_DIR)
28 + install -m 4755 -D -s -o root -g root node $(SBIN_DIR)/node
29 + install -m 755 -D -s -o root -g root nodeusers $(SBIN_DIR)/nodeusers
32 - install -m 755 -o root -g root -d $(LIB_DIR)/ax25/node/help
33 - install -m 644 -o root -g root etc/help/*.hlp $(LIB_DIR)/ax25/node/help
34 + install -m 755 -D -o root -g root -d $(LIB_DIR)/ax25/node/help
35 + install -m 644 -D -o root -g root etc/help/*.hlp $(LIB_DIR)/ax25/node/help
37 installconf: installhelp
38 - install -m 755 -o root -g root -d $(ETC_DIR)
39 - install -m 600 -o root -g root etc/node.conf $(ETC_DIR)
40 - install -m 600 -o root -g root etc/node.perms $(ETC_DIR)
41 - install -m 600 -o root -g root etc/node.motd $(ETC_DIR)
42 + install -m 755 -D -o root -g root -d $(ETC_DIR)
43 + install -m 600 -D -o root -g root etc/node.conf $(ETC_DIR)
44 + install -m 600 -D -o root -g root etc/node.perms $(ETC_DIR)
45 + install -m 600 -D -o root -g root etc/node.motd $(ETC_DIR)
48 - install -m 644 -o bin -g bin man/nodeusers.1 $(MAN_DIR)/man1
49 - install -m 644 -o bin -g bin man/node.conf.5 $(MAN_DIR)/man5
50 - install -m 644 -o bin -g bin man/node.perms.5 $(MAN_DIR)/man5
51 - install -m 644 -o bin -g bin man/node.8 $(MAN_DIR)/man8
52 + install -m 644 -D -o bin -g bin man/nodeusers.1 $(MAN_DIR)/man1
53 + install -m 644 -D -o bin -g bin man/node.conf.5 $(MAN_DIR)/man5
54 + install -m 644 -D -o bin -g bin man/node.perms.5 $(MAN_DIR)/man5
55 + install -m 644 -D -o bin -g bin man/node.8 $(MAN_DIR)/man8
58 rm -f *.o *~ *.bak *.orig
59 diff --git Makefile.include.in Makefile.include.in
60 index 547891f..ef5e061 100644
61 --- Makefile.include.in
62 +++ Makefile.include.in
68 -SBIN_DIR = @SBIN_DIR@
73 +ETC_DIR = $(DESTDIR)@ETC_DIR@
74 +SBIN_DIR = $(DESTDIR)@SBIN_DIR@
75 +BIN_DIR = $(DESTDIR)@BIN_DIR@
76 +LIB_DIR = $(DESTDIR)@LIB_DIR@
77 +MAN_DIR = $(DESTDIR)@MAN_DIR@
78 +VAR_DIR = $(DESTDIR)@VAR_DIR@
82 diff --git command.c command.c
83 index 1d6caaa..98de36a 100644
86 @@ -59,7 +59,7 @@ void logout(char *reason)
90 - log(L_LOGIN, "%s @ %s logged out: %s", User.call, User.ul_name, reason);
91 + n_log(L_LOGIN, "%s @ %s logged out: %s", User.call, User.ul_name, reason);
92 free_cmdlist(Nodecmds);
95 diff --git config.c config.c
96 index 5111bd1..377b201 100644
99 @@ -110,7 +110,7 @@ char *read_perms(struct user *up, unsigned long peer)
102 node_msg("Configuration error");
103 - log(L_ERROR, "Syntax error in permission file at line %d", n);
104 + n_log(L_ERROR, "Syntax error in permission file at line %d", n);
107 if (strcmp(argv[0], "*") && strcasecmp(argv[0], up->call))
108 @@ -227,7 +227,7 @@ static int do_escapechar(int argc, char **argv)
109 EscChar = get_escape(argv[1]);
110 if (EscChar < -1 || EscChar > 255) {
111 node_msg("Configuration error");
112 - log(L_ERROR, "do_escapechar: Invalid escape character %s",
113 + n_log(L_ERROR, "do_escapechar: Invalid escape character %s",
117 @@ -304,7 +304,7 @@ static int do_hiddenports(int argc, char **argv)
118 for (i = 1; i < argc && i < 31; i++) {
119 if (ax25_config_get_dev(argv[i]) == NULL) {
120 node_msg("Configuration error");
121 - log(L_ERROR, "do_hiddenports: invalid port %s", argv[i]);
122 + n_log(L_ERROR, "do_hiddenports: invalid port %s", argv[i]);
125 HiddenPorts[i - 1] = strdup(argv[i]);
126 @@ -339,7 +339,7 @@ static int do_extcmd(int argc, char **argv)
127 new->flags = atoi(argv[2]);
128 if ((pw = getpwnam(argv[3])) == NULL) {
129 node_msg("Configuration error");
130 - log(L_ERROR, "do_extcmd: Unknown user %s", argv[3]);
131 + n_log(L_ERROR, "do_extcmd: Unknown user %s", argv[3]);
134 new->uid = pw->pw_uid;
135 @@ -409,7 +409,7 @@ int read_config(void)
136 ret = cmdparse(cfg_cmds, line);
138 node_msg("Configuration error");
139 - log(L_ERROR, "Syntax error in config file at line %d: %s", n, line);
140 + n_log(L_ERROR, "Syntax error in config file at line %d: %s", n, line);
144 diff --git configure configure
145 index 58704b0..52261f0 100755
148 @@ -47,25 +47,25 @@ fi
152 - echo -n "Include support for the AX.25 protocol ? [Y/n]: "; read answer
153 - if [ "$answer" = "Y" -o "$answer" = "y" -o "$answer" = "" ]
155 + #echo -n "Include support for the AX.25 protocol ? [Y/n]: "; read answer
156 + #if [ "$answer" = "Y" -o "$answer" = "y" -o "$answer" = "" ]
162 - echo -n "Include support for the NetRom protocol ? [Y/n]: "; read answer
163 - if [ "$answer" = "Y" -o "$answer" = "y" -o "$answer" = "" ]
166 + #echo -n "Include support for the NetRom protocol ? [Y/n]: "; read answer
167 + #if [ "$answer" = "Y" -o "$answer" = "y" -o "$answer" = "" ]
169 + # HAVEAX25="#define"
174 - echo -n "Include support for the Rose protocol ? [Y/n]: "; read answer
175 - if [ "$answer" = "Y" -o "$answer" = "y" -o "$answer" = "" ]
178 + #echo -n "Include support for the Rose protocol ? [Y/n]: "; read answer
179 + #if [ "$answer" = "Y" -o "$answer" = "y" -o "$answer" = "" ]
181 + # HAVEAX25="#define"
186 echo "Creating Makefile.include"
188 diff --git gateway.c gateway.c
189 index 702bca9..ed37a93 100644
192 @@ -55,7 +55,8 @@ static ax25io *connect_to(char **addr, int family, int escape, int compr)
194 struct in_addr inaddr;
195 char call[10], path[20], *cp, *eol;
196 - int ret, retlen = sizeof(int);
197 + int ret = sizeof(int);
202 @@ -72,7 +73,7 @@ static ax25io *connect_to(char **addr, int family, int escape, int compr)
204 if (check_perms(PERM_ROSE, 0L) == -1) {
205 node_msg("Permission denied");
206 - log(L_GW, "Permission denied: rose");
207 + n_log(L_GW, "Permission denied: rose");
210 if ((fd = socket(AF_ROSE, SOCK_SEQPACKET, 0)) < 0) {
211 @@ -124,7 +125,7 @@ static ax25io *connect_to(char **addr, int family, int escape, int compr)
213 if (check_perms(PERM_NETROM, 0L) == -1) {
214 node_msg("Permission denied");
215 - log(L_GW, "Permission denied: netrom");
216 + n_log(L_GW, "Permission denied: netrom");
219 if ((fd = socket(AF_NETROM, SOCK_SEQPACKET, 0)) < 0) {
220 @@ -159,7 +160,7 @@ static ax25io *connect_to(char **addr, int family, int escape, int compr)
222 if (check_perms(PERM_AX25, 0L) == -1 || (is_hidden(addr[0]) && check_perms(PERM_HIDDEN, 0L) == -1)) {
223 node_msg("Permission denied");
224 - log(L_GW, "Permission denied: ax.25 port %s", addr[0]);
225 + n_log(L_GW, "Permission denied: ax.25 port %s", addr[0]);
228 if (ax25_config_get_addr(addr[0]) == NULL) {
229 @@ -241,7 +242,7 @@ static ax25io *connect_to(char **addr, int family, int escape, int compr)
231 if (check_perms(PERM_TELNET, sa.in.sin_addr.s_addr) == -1) {
232 node_msg("Permission denied");
233 - log(L_GW, "Permission denied: telnet %s", print_dl(&User));
234 + n_log(L_GW, "Permission denied: telnet %s", print_dl(&User));
238 @@ -310,7 +311,7 @@ static ax25io *connect_to(char **addr, int family, int escape, int compr)
239 cp = strdup(strerror(ret));
241 node_msg_block("Failure with %s: %s", print_dl(&User), cp);
242 - log(L_GW, "Failure with %s: %s", print_dl(&User), cp);
243 + n_log(L_GW, "Failure with %s: %s", print_dl(&User), cp);
247 @@ -339,7 +340,7 @@ static ax25io *connect_to(char **addr, int family, int escape, int compr)
248 escape < 32 ? (escape + 'A' - 1) : escape);
251 - log(L_GW, "Connected to %s", print_dl(&User));
252 + n_log(L_GW, "Connected to %s", print_dl(&User));
254 if ((riop = axio_init(fd, fd, paclen, eol)) == NULL) {
255 node_perror("connect_to: Initializing I/O failed", errno);
256 @@ -536,7 +537,7 @@ int do_connect(int argc, char **argv)
260 - log(L_GW, "Disconnected from %s", print_dl(&User));
261 + n_log(L_GW, "Disconnected from %s", print_dl(&User));
264 axio_eolmode(NodeIo, EOLMODE_TEXT);
265 @@ -608,10 +609,10 @@ static long calc_rtt(struct timeval tv1, struct timeval tv2)
267 * Checksum routine for Internet Protocol family headers (C Version)
269 -static unsigned short in_cksum(unsigned char *addr, int len)
270 +static unsigned short in_cksum(char *addr, int len)
272 register int nleft = len;
273 - register unsigned char *w = addr;
274 + register char *w = addr;
275 register unsigned int sum = 0;
276 unsigned short answer = 0;
278 @@ -670,7 +671,7 @@ static int check_icmp(char *buf, int len, struct sockaddr_in *from, long rtt)
280 int do_ping(int argc, char **argv)
282 - unsigned char buf[256];
285 struct sockaddr_in to, from;
286 struct in_addr inaddr;
287 @@ -679,8 +680,8 @@ int do_ping(int argc, char **argv)
288 struct timeval tv1, tv2;
290 int fd, i, len = sizeof(struct icmphdr);
291 - int salen = sizeof(struct sockaddr);
296 node_msg("Usage: ping <host> [<size>]");
298 diff --git ipc.c ipc.c
299 index 1c4f022..86609ee 100644
302 @@ -32,7 +32,7 @@ static void usr2_handler(int sig)
303 nprintf("\n%s %s\n", NodeId, buf.mtext);
306 - log(L_ERROR, "usr2_handler: Caught SIGUSR2, but couldn't receive a message");
307 + n_log(L_ERROR, "usr2_handler: Caught SIGUSR2, but couldn't receive a message");
309 signal(SIGUSR2, usr2_handler); /* Restore handler */
311 @@ -90,7 +90,7 @@ int ipc_close(void)
313 if (ipc_id != -1) /* Remove the IPC channel */
314 if (msgctl(ipc_id, IPC_RMID, &buf) == -1) {
315 - log(L_ERROR, "ipc_close: Could not remove IPC channel: %s", strerror(errno));
316 + n_log(L_ERROR, "ipc_close: Could not remove IPC channel: %s", strerror(errno));
321 index 04f6480..423cae0 100755
322 Binary files node and node differ
323 diff --git node.c node.c
324 index 0a7f5dd..81a1ccd 100644
327 @@ -90,7 +90,7 @@ int main(int argc, char *argv[])
328 struct sockaddr_rose srose;
329 struct sockaddr_in sin;
331 - int slen = sizeof(saddr);
332 + socklen_t slen = sizeof(saddr);
333 char *p, buf[256], *pw;
336 @@ -104,7 +104,7 @@ int main(int argc, char *argv[])
337 signal(SIGPIPE, SIG_IGN);
339 if (ax25_config_load_ports() == 0) {
340 - log(L_ERROR, "No AX.25 port data configured");
341 + n_log(L_ERROR, "No AX.25 port data configured");
344 nr_config_load_ports();
345 @@ -112,7 +112,7 @@ int main(int argc, char *argv[])
347 if (getpeername(STDOUT_FILENO, (struct sockaddr *)&saddr, &slen) == -1) {
348 if (errno != ENOTSOCK) {
349 - log(L_ERROR, "getpeername: %s", strerror(errno));
350 + n_log(L_ERROR, "getpeername: %s", strerror(errno));
353 User.ul_type = AF_UNSPEC;
354 @@ -123,7 +123,7 @@ int main(int argc, char *argv[])
356 strcpy(User.call, ax25_ntoa(&saddr.sax.fsa_ax25.sax25_call));
357 if (getsockname(STDOUT_FILENO, (struct sockaddr *)&saddr.sax, &slen) == -1) {
358 - log(L_ERROR, "getsockname: %s", strerror(errno));
359 + n_log(L_ERROR, "getsockname: %s", strerror(errno));
362 strcpy(User.ul_name, ax25_config_get_port(&saddr.sax.fsa_digipeater[0]));
363 @@ -134,7 +134,7 @@ int main(int argc, char *argv[])
364 strcpy(User.call, ax25_ntoa(&saddr.sax.fsa_ax25.sax25_call));
365 strcpy(User.ul_name, ax25_ntoa(&saddr.sax.fsa_digipeater[0]));
366 if (getsockname(STDOUT_FILENO, (struct sockaddr *)&saddr.sax, &slen) == -1) {
367 - log(L_ERROR, "getsockname: %s", strerror(errno));
368 + n_log(L_ERROR, "getsockname: %s", strerror(errno));
371 strcpy(User.ul_port, nr_config_get_port(&saddr.sax.fsa_ax25.sax25_call));
372 @@ -155,7 +155,7 @@ int main(int argc, char *argv[])
374 strcpy(User.ul_name, "local");
375 if ((p = get_call(getuid())) == NULL) {
376 - log(L_ERROR, "No uid->callsign association found", -1);
377 + n_log(L_ERROR, "No uid->callsign association found", -1);
380 strcpy(User.call, p);
381 @@ -163,14 +163,14 @@ int main(int argc, char *argv[])
385 - log(L_ERROR, "Unsupported address family %d", User.ul_type);
386 + n_log(L_ERROR, "Unsupported address family %d", User.ul_type);
390 NodeIo = axio_init(STDIN_FILENO, STDOUT_FILENO, paclen, p);
392 if (NodeIo == NULL) {
393 - log(L_ERROR, "Error initializing I/O");
394 + n_log(L_ERROR, "Error initializing I/O");
398 @@ -201,7 +201,7 @@ int main(int argc, char *argv[])
399 strncpy(User.ul_name, hp->h_name, 31);
400 User.ul_name[31] = 0;
402 - log(L_ERROR, "gethostbyaddr: %s", strherror(h_errno));
403 + n_log(L_ERROR, "gethostbyaddr: %s", strherror(h_errno));
406 User.state = STATE_LOGIN;
407 @@ -224,13 +224,13 @@ int main(int argc, char *argv[])
409 if (check_call(User.call) == -1) {
410 node_msg("Invalid callsign");
411 - log(L_LOGIN, "Invalid callsign %s @ %s", User.call, User.ul_name);
412 + n_log(L_LOGIN, "Invalid callsign %s @ %s", User.call, User.ul_name);
413 logout("Invalid callsign");
416 if ((pw = read_perms(&User, saddr.sin.sin_addr.s_addr)) == NULL) {
417 node_msg("Sorry, I'm not allowed to talk to you...");
418 - log(L_LOGIN, "Login denied for %s @ %s", User.call, User.ul_name);
419 + n_log(L_LOGIN, "Login denied for %s @ %s", User.call, User.ul_name);
420 logout("Login denied");
421 } else if (strcmp(pw, "*") != 0) {
423 @@ -248,7 +248,7 @@ int main(int argc, char *argv[])
424 if (p == NULL || strcmp(p, pw) != 0) {
426 node_msg("Login failed");
427 - log(L_LOGIN, "Login failed for %s @ %s", User.call, User.ul_name);
428 + n_log(L_LOGIN, "Login failed for %s @ %s", User.call, User.ul_name);
429 logout("Login failed");
432 @@ -266,7 +266,7 @@ int main(int argc, char *argv[])
436 - log(L_LOGIN, "%s @ %s logged in", User.call, User.ul_name);
437 + n_log(L_LOGIN, "%s @ %s logged in", User.call, User.ul_name);
441 diff --git node.h node.h
442 index d630c02..4f03967 100644
445 @@ -116,7 +116,7 @@ extern void node_perror(char *, int);
446 extern char *print_node(const char *, const char *);
447 extern char *print_dl(struct user *);
448 extern int put_prompt(void);
449 -extern void log(int, const char *, ...);
450 +extern void n_log(int, const char *, ...);
451 extern char *strherror(int);
454 diff --git nodeusers nodeusers
455 index 9f7d57f..06e96e4 100755
456 Binary files nodeusers and nodeusers differ
457 diff --git user.c user.c
458 index b182b6e..f8487d5 100644
461 @@ -37,7 +37,7 @@ void login_user(void)
463 if (statbuf.st_size % sizeof(struct user) != 0) {
464 node_msg("%s: Incorrect size", DATA_NODE_LOGIN_FILE);
465 - log(L_ERROR, "%s: Incorrect size", DATA_NODE_LOGIN_FILE);
466 + n_log(L_ERROR, "%s: Incorrect size", DATA_NODE_LOGIN_FILE);
470 diff --git util.c util.c
471 index cb5b912..149f288 100644
474 @@ -29,7 +29,7 @@ static int set_nonblock(int fd, int flag)
475 // fprintf(stderr, "fd=%d flag=%d 0%lo -> 0%lo\n", fd, flag, oldflags, newflags);
477 if (fcntl(fd, F_SETFL, newflags) == -1) {
478 - log(LOG_ERR, "node_set_nonblock: fnctl(%lo,%lo): %m", fd, newflags);
479 + n_log(LOG_ERR, "node_set_nonblock: fnctl(%lo,%lo): %m", fd, newflags);
480 logout("fcntl failed");
483 @@ -39,7 +39,7 @@ static int set_nonblock(int fd, int flag)
484 static int set_fd_flags(int fd, int flags)
486 if (fcntl(fd, F_SETFL, flags) == -1) {
487 - log(LOG_ERR, "node_set_fd_flags: fnctl(%d,&d): %m", fd, flags);
488 + n_log(LOG_ERR, "node_set_fd_flags: fnctl(%d,&d): %m", fd, flags);
489 logout("fcntl failed");
492 @@ -158,7 +158,7 @@ void node_perror(char *str, int err)
493 /* return original blocking state */
494 set_fd_flags(NodeIo->ofd, flags);
497 + n_log(L_ERROR, buf);
500 char *print_node(const char *alias, const char *call)
501 @@ -208,7 +208,7 @@ int put_prompt(void)
505 -void log(int loglevel, const char *fmt, ...)
506 +void n_log(int loglevel, const char *fmt, ...)
508 static int opened = 0;