/*
- * $Id: afp_asp.c,v 1.7 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: afp_asp.c,v 1.8 2001-12-10 20:16:53 srittau Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
#include <string.h>
#include <signal.h>
#include <syslog.h>
+#include <errno.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif /* HAVE_SYS_TIME_H */
asp_attention(asp, AFPATTN_SHUTDOWN);
if ( asp_shutdown( asp ) < 0 ) {
- syslog( LOG_ERR, "afp_die: asp_shutdown: %m" );
+ syslog( LOG_ERR, "afp_die: asp_shutdown: %s", strerror(errno) );
}
afp_asp_close(child);
it.it_value.tv_sec = 300;
it.it_value.tv_usec = 0;
if ( setitimer( ITIMER_REAL, &it, 0 ) < 0 ) {
- syslog( LOG_ERR, "afp_timedown: setitimer: %m" );
+ syslog( LOG_ERR, "afp_timedown: setitimer: %s", strerror(errno) );
afp_asp_die(1);
}
sigemptyset( &sv.sa_mask );
sv.sa_flags = SA_RESTART;
if ( sigaction( SIGALRM, &sv, 0 ) < 0 ) {
- syslog( LOG_ERR, "afp_timedown: sigaction: %m" );
+ syslog( LOG_ERR, "afp_timedown: sigaction: %s", strerror(errno) );
afp_asp_die(1);
}
}
sigemptyset( &action.sa_mask );
action.sa_flags = SA_RESTART;
if ( sigaction( SIGHUP, &action, 0 ) < 0 ) {
- syslog( LOG_ERR, "afp_over_asp: sigaction: %m" );
+ syslog( LOG_ERR, "afp_over_asp: sigaction: %s", strerror(errno) );
afp_asp_die(1);
}
sigemptyset( &action.sa_mask );
action.sa_flags = SA_RESTART;
if ( sigaction( SIGTERM, &action, 0 ) < 0 ) {
- syslog( LOG_ERR, "afp_over_asp: sigaction: %m" );
+ syslog( LOG_ERR, "afp_over_asp: sigaction: %s", strerror(errno) );
afp_asp_die(1);
}
if(unlink(addr_filename) == 0) {
syslog(LOG_INFO, "removed %s", addr_filename);
} else {
- syslog(LOG_INFO, "error removing %s: %m", addr_filename);
+ syslog(LOG_INFO, "error removing %s: %s",
+ addr_filename, strerror(errno));
}
} else {
- syslog(LOG_INFO, "error stat'ing %s: %m", addr_filename);
+ syslog(LOG_INFO, "error stat'ing %s: %s",
+ addr_filename, strerror(errno));
}
}
}
if ( asp_cmdreply( asp, reply ) < 0 ) {
- syslog( LOG_ERR, "asp_cmdreply: %m" );
+ syslog( LOG_ERR, "asp_cmdreply: %s", strerror(errno) );
afp_asp_die(1);
}
break;
bprint( asp->data, asp->datalen );
}
if ( asp_wrtreply( asp, reply ) < 0 ) {
- syslog( LOG_ERR, "asp_wrtreply: %m" );
+ syslog( LOG_ERR, "asp_wrtreply: %s", strerror(errno) );
afp_asp_die(1);
}
break;
/*
- * $Id: afp_config.c,v 1.8 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: afp_config.c,v 1.9 2001-12-10 20:16:53 srittau Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All Rights Reserved. See COPYRIGHT.
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
/* STDC check */
#if STDC_HEADERS
if (!(asp = asp_getsession(config->obj.handle, server_children,
config->obj.options.tickleval))) {
- syslog( LOG_ERR, "main: asp_getsession: %m" );
+ syslog( LOG_ERR, "main: asp_getsession: %s", strerror(errno) );
exit( 1 );
}
if (!(dsi = dsi_getsession(config->obj.handle, server_children,
config->obj.options.tickleval))) {
- syslog( LOG_ERR, "main: dsi_getsession: %m" );
+ syslog( LOG_ERR, "main: dsi_getsession: %s", strerror(errno) );
exit( 1 );
}
return NULL;
if ((atp = atp_open(ATADDR_ANYPORT, &options->ddpaddr)) == NULL) {
- syslog( LOG_ERR, "main: atp_open: %m");
+ syslog( LOG_ERR, "main: atp_open: %s", strerror(errno) );
free(config);
return NULL;
}
if ((asp = asp_init( atp )) == NULL) {
- syslog( LOG_ERR, "main: asp_init: %m" );
+ syslog( LOG_ERR, "main: asp_init: %s", strerror(errno) );
atp_close(atp);
free(config);
return NULL;
#endif /* USE_SRVLOC */
if ((config = (AFPConfig *) calloc(1, sizeof(AFPConfig))) == NULL) {
- syslog( LOG_ERR, "DSIConfigInit: malloc(config): %m" );
+ syslog( LOG_ERR, "DSIConfigInit: malloc(config): %s", strerror(errno) );
return NULL;
}
options->ipaddr, options->port,
options->flags & OPTION_PROXY,
options->server_quantum)) == NULL) {
- syslog( LOG_ERR, "main: dsi_init: %m" );
+ syslog( LOG_ERR, "main: dsi_init: %s", strerror(errno) );
free(config);
return NULL;
}
if ((refcount = (unsigned char *)
calloc(1, sizeof(unsigned char))) == NULL) {
- syslog( LOG_ERR, "AFPConfigInit: calloc(refcount): %m" );
+ syslog( LOG_ERR, "AFPConfigInit: calloc(refcount): %s", strerror(errno) );
return NULL;
}
/*
- * $Id: afp_dsi.c,v 1.10 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: afp_dsi.c,v 1.11 2001-12-10 20:16:53 srittau Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
function = (u_char) dsi->commands[0];
if (obj->options.flags & OPTION_DEBUG ) {
printf("command: %d\n", function);
- bprint(dsi->commands, dsi->cmdlen);
+ bprint((char *) dsi->commands, dsi->cmdlen);
}
/* send off an afp command. in a couple cases, we take advantage
if (obj->options.flags & OPTION_DEBUG ) {
printf( "reply: %d, %d\n", err, dsi->clientID);
- bprint(dsi->data, dsi->datalen);
+ bprint((char *) dsi->data, dsi->datalen);
}
if (!dsi_cmdreply(dsi, err)) {
function = (u_char) dsi->commands[0];
if ( obj->options.flags & OPTION_DEBUG ) {
printf("(write) command: %d, %d\n", function, dsi->cmdlen);
- bprint(dsi->commands, dsi->cmdlen);
+ bprint((char *) dsi->commands, dsi->cmdlen);
}
if ( afp_switch[ function ] != NULL ) {
if (obj->options.flags & OPTION_DEBUG ) {
printf( "(write) reply code: %d, %d\n", err, dsi->clientID);
- bprint(dsi->data, dsi->datalen);
+ bprint((char *) dsi->data, dsi->datalen);
}
if (!dsi_wrtreply(dsi, err)) {
/*
- * $Id: desktop.c,v 1.8 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: desktop.c,v 1.9 2001-12-10 20:16:54 srittau Exp $
*
* See COPYRIGHT.
*/
char *mtoupath(const struct vol *vol, char *mpath)
{
- static unsigned char upath[ MAXPATHLEN + 1];
- unsigned char *m, *u;
+ static char upath[ MAXPATHLEN + 1];
+ char *m, *u;
int i = 0;
if ( *mpath == '\0' ) {
#if 1
if (vol->v_mtoupage && ((*m & 0x80) ||
vol->v_flags & AFPVOL_MAPASCII)) {
- *u = vol->v_mtoupage->map[*m].value;
+ *u = vol->v_mtoupage->map[(unsigned char) *m].value;
} else
#endif /* 1 */
#if AD_VERSION == AD_VERSION1
char *utompath(const struct vol *vol, char *upath)
{
- static unsigned char mpath[ MAXPATHLEN + 1];
- unsigned char *m, *u;
- int h;
+ static char mpath[ MAXPATHLEN + 1];
+ char *m, *u;
+ int h;
/* do the hex conversion */
u = upath;
while ( *u != '\0' ) {
/* we have a code page */
#if 1
- if (vol->v_utompage && ((*u > 0x7F) ||
+ if (vol->v_utompage && ((*u & 0x80) ||
(vol->v_flags & AFPVOL_MAPASCII))) {
- *m = vol->v_utompage->map[*u].value;
+ *m = vol->v_utompage->map[(unsigned char) *u].value;
} else
#endif /* 1 */
if ( *u == ':' && *(u+1) != '\0' && islxdigit( *(u+1)) &&
/*
- * $Id: directory.c,v 1.20 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: directory.c,v 1.21 2001-12-10 20:16:54 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include "volume.h"
#include "fork.h"
#include "file.h"
+#include "filedir.h"
#include "globals.h"
#include "unix.h"
/*
- * $Id: enumerate.c,v 1.10 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: enumerate.c,v 1.11 2001-12-10 20:16:54 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include "volume.h"
#include "globals.h"
#include "file.h"
+#include "filedir.h"
/* check for mtab DID code */
#ifdef DID_MTAB
/*
- * $Id: icon.h,v 1.3 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: icon.h,v 1.4 2001-12-10 20:16:54 srittau Exp $
*
* Copyright (c) 1990,1994 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
};
#if defined( ultrix )
-const u_char icon[] = { /* declogo */
+const unsigned char icon[] = { /* declogo */
0x0, 0x80, 0x0, 0x0, 0x1, 0xC0, 0x0, 0x0,
0x3, 0xE0, 0x0, 0x0, 0x7, 0xF0, 0x0, 0x0,
0xF, 0xB0, 0x0, 0x0, 0x13, 0x6C, 0x0, 0x0,
#else
#if defined( vax )
-const u_char icon[] = { /* daemon */
+const unsigned char icon[] = { /* daemon */
0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x2, 0x0,
0x1, 0x80, 0x3, 0x0, 0x2, 0x80, 0x2, 0x80,
0x2, 0x80, 0x2, 0x80, 0x4, 0x80, 0x2, 0x40,
#else
#if defined( sun )
-const u_char icon[] = { /* sunlogo */
+const unsigned char icon[] = { /* sunlogo */
0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x80, 0x0,
0x0, 0x2, 0x40, 0x0, 0x0, 0x2, 0x20, 0x0,
0x0, 0x9, 0x10, 0x0, 0x0, 0x4, 0x88, 0x0,
#else
#if defined( _IBMR2 )
-const u_char icon[] = { /* hagar */
+const unsigned char icon[] = { /* hagar */
0x0, 0x0, 0x0, 0x0, 0x18, 0x0, 0x0, 0x18,
0x24, 0x0, 0x0, 0x24, 0x44, 0x3, 0xC0, 0x22,
0x44, 0xC, 0x30, 0x22, 0x42, 0x30, 0xC, 0x42,
};
#else
-const u_char icon[] = { /* globe */
+const unsigned char icon[] = { /* globe */
0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF0, 0x0,
0x0, 0x30, 0xC, 0x0, 0x0, 0xC0, 0x3, 0x0,
0x1, 0x80, 0x3, 0x80, 0x3, 0xE2, 0x1F, 0xC0,
/*
- * $Id: main.c,v 1.13 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: main.c,v 1.14 2001-12-10 20:16:54 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
unsigned char nologin = 0;
+#ifdef DID_MTAB
+/* global mount table; afpd_st_cnid uses this to lookup the right entry. */
+static struct afpd_mount_table *afpd_mount_table = NULL;
+#endif /* DID_MTAB */
+
struct afp_options default_options;
static AFPConfig *configs;
static server_child *server_children;
/*
- * $Id: messages.c,v 1.10 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: messages.c,v 1.11 2001-12-10 20:16:54 srittau Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All Rights Reserved. See COPYRIGHT.
uid_t euid;
i=0;
- // Construct file name SERVERTEXT/message.[pid]
+ /* Construct file name SERVERTEXT/message.[pid] */
filename=malloc(sizeof(SERVERTEXT)+15);
sprintf(filename, "%s/message.%d", SERVERTEXT, getpid());
/*
- * $Id: parse_mtab.c,v 1.5 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: parse_mtab.c,v 1.6 2001-12-10 20:16:54 srittau Exp $
*
* afpd_mtab_parse & support. -- rgr, 9-Apr-01.
*/
(lval) = malloc(1+strlen(str)), strcpy((lval), (str))
#endif /* COPY_STRING */
+/* global mount table; afpd_st_cnid uses this to lookup the right entry. */
+static struct afpd_mount_table *afpd_mount_table;
+
static int
ceil_log_2 __P((int n))
/* Return the number of bits required to represent n. Only works for
/*
- * $Id: parse_mtab.h,v 1.4 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: parse_mtab.h,v 1.5 2001-12-10 20:16:54 srittau Exp $
*
* header for afpd_mtab_parse, afpd_st_cnid
*/
entries may be null */
};
-/* global mount table; afpd_st_cnid uses this to lookup the right entry. */
-static struct afpd_mount_table *afpd_mount_table = NULL;
-
extern
unsigned int
afpd_st_cnid __P((struct stat *st));
/*
- * $Id: quota.c,v 1.12 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: quota.c,v 1.13 2001-12-10 20:16:54 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
/* STDC check */
#if STDC_HEADERS
}
if (( vol->v_gvs = (char *)malloc( strlen( p ) + 1 )) == NULL ) {
- syslog( LOG_ERR, "getquota: malloc: %m" );
+ syslog( LOG_ERR, "getquota: malloc: %s", strerror(errno) );
return AFPERR_MISC;
}
strcpy( vol->v_gvs, p );
}
#else /* ultrix */
if ( gettimeofday( &tv, 0 ) < 0 ) {
- syslog( LOG_ERR, "overquota: gettimeofday: %m" );
+ syslog( LOG_ERR, "overquota: gettimeofday: %s", strerror(errno) );
return( AFPERR_PARAM );
}
if ( !dqblk->dqb_btimelimit || dqblk->dqb_btimelimit > tv.tv_sec ) {
/*
- * $Id: status.c,v 1.5 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: status.c,v 1.6 2001-12-10 20:16:54 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
}
/* returns actual offset to signature */
-static void status_icon(char *data, const char *icondata,
+static void status_icon(char *data, const unsigned char *icondata,
const int iconlen, const int sigoffset)
{
char *start = data;
/*
- * $Id: uam.c,v 1.16 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: uam.c,v 1.17 2001-12-10 20:16:54 srittau Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* All Rights Reserved. See COPYRIGHT.
#include <ctype.h>
#include <syslog.h>
#include <sys/param.h>
+#include <sys/socket.h>
#include <sys/time.h>
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif /* HAVE_DLFCN_H */
-#ifdef SHADOWPW
-#include <shadow.h>
-#endif /* SHADOWPW */
+#include <netinet/in.h>
+#include <arpa/inet.h>
#include <netatalk/endian.h>
#include <atalk/asp.h>
#ifdef TRU64
#include <netdb.h>
-#include <arpa/inet.h>
#endif /* TRU64 */
/* --- server uam functions -- */
/*
- * $Id: aep.c,v 1.4 2001-06-25 20:13:45 rufustfirefly Exp $
+ * $Id: aep.c,v 1.5 2001-12-10 20:16:54 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include "config.h"
#endif /* HAVE_CONFIG_H */
+#include <string.h>
+#include <errno.h>
+
#include <sys/syslog.h>
#include <sys/types.h>
#include <sys/socket.h>
*( data + 1 ) = AEPOP_REPLY;
if ( sendto( ap->ap_fd, data, len, 0, (struct sockaddr *)from,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "aep sendto: %m" );
+ syslog( LOG_ERR, "aep sendto: %s", strerror(errno) );
return 1;
}
/*
- * $Id: config.c,v 1.6 2001-09-06 20:00:59 rufustfirefly Exp $
+ * $Id: config.c,v 1.7 2001-12-10 20:16:55 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include <atalk/util.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
/* STDC check */
#if STDC_HEADERS
#endif /* ! HAVE_MEMCPY */
#endif /* STDC_HEADERS */
-#include <ctype.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif /* HAVE_FCNTL_H */
-#include <errno.h>
#ifdef __svr4__
#include <sys/sockio.h>
sprintf( newpath, "%.*s/%s", (int)(p - path), path, _PATH_ATALKDTMP );
}
if (( fd = open( newpath, O_WRONLY|O_CREAT|O_TRUNC, mode )) < 0 ) {
- syslog( LOG_ERR, "%s: %m", newpath );
+ syslog( LOG_ERR, "%s: %s", newpath, strerror(errno) );
return( -1 );
}
if (( newconf = fdopen( fd, "w" )) == NULL ) {
- syslog( LOG_ERR, "fdreopen %s: %m", newpath );
+ syslog( LOG_ERR, "fdreopen %s: %s", newpath, strerror(errno) );
return( -1 );
}
if (( conf = fopen( path, "r" )) == NULL && cf ) {
- syslog( LOG_ERR, "%s: %m", path );
+ syslog( LOG_ERR, "%s: %s", path, strerror(errno) );
return( -1 );
}
while ( conf == NULL || fgets( line, sizeof( line ), conf ) != NULL ) {
if ( conf != NULL && ( argv = parseline( line )) == NULL ) {
if ( fputs( line, newconf ) == EOF ) {
- syslog( LOG_ERR, "fputs: %m" );
+ syslog( LOG_ERR, "fputs: %s", strerror(errno) );
return( -1 );
}
continue;
fclose( newconf );
if ( rename( newpath, path ) < 0 ) {
- syslog( LOG_ERR, "rename %s to %s: %m", newpath, path );
+ syslog( LOG_ERR, "rename %s to %s: %s", newpath, path, strerror(errno) );
return( -1 );
}
return( 0 );
/*
- * $Id: main.c,v 1.10 2001-09-12 19:13:17 uhees Exp $
+ * $Id: main.c,v 1.11 2001-12-10 20:16:55 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
continue;
#endif /* SIOCDIFADDR != SIOCATALKDIFADDR */
#endif /* SIOCATALKIFADDR */
- syslog( LOG_ERR, "difaddr(%u.%u): %m",
+ syslog( LOG_ERR, "difaddr(%u.%u): %s",
ntohs(iface->i_addr.sat_addr.s_net),
- iface->i_addr.sat_addr.s_node);
+ iface->i_addr.sat_addr.s_node, strerror(errno));
}
}
#endif /* SOPCDOFADDR */
if ( iface->i_time < 3 ) {
if ( iface->i_flags & IFACE_PHASE1 ) {
if (rtmp_request( iface ) < 0) {
- syslog(LOG_ERR, "rtmp_request: %m");
+ syslog(LOG_ERR, "rtmp_request: %s", strerror(errno));
atalkd_exit(1);
}
newrtmpdata = 1;
} else {
if (zip_getnetinfo( iface ) < 0) {
- syslog(LOG_ERR, "zip_getnetinfo: %m");
+ syslog(LOG_ERR, "zip_getnetinfo: %s", strerror(errno));
atalkd_exit(1);
}
sentzipq = 1;
for ( zt = iface->i_czt; zt; zt = zt->zt_next ) {
if (addzone( iface->i_rt, zt->zt_len,
zt->zt_name) < 0) {
- syslog(LOG_ERR, "addzone: %m");
+ syslog(LOG_ERR, "addzone: %s", strerror(errno));
atalkd_exit(1);
}
}
if ( looproute( iface, RTMP_ADD )) { /* -1 or 1 */
syslog( LOG_ERR,
- "as_timer: can't route %u.%u to loop: %m",
+ "as_timer: can't route %u.%u to loop: %s",
ntohs( iface->i_addr.sat_addr.s_net ),
- iface->i_addr.sat_addr.s_node );
+ iface->i_addr.sat_addr.s_node,
+ strerror(errno) );
atalkd_exit( 1 );
}
if ( iface == ciface ) {
}
if ( looproute( iface, RTMP_ADD ) ) { /* -1 or 1 */
syslog( LOG_ERR,
- "as_timer: can't route %u.%u to loopback: %m",
+ "as_timer: can't route %u.%u to loopback: %s",
ntohs( iface->i_addr.sat_addr.s_net ),
- iface->i_addr.sat_addr.s_node );
+ iface->i_addr.sat_addr.s_node,
+ strerror(errno) );
atalkd_exit( 1 );
}
} else {
rtmp->rt_hops = RTMPHOPS_POISON;
if ((cc = rtmp_replace( rtmp )) < 0) {
- syslog(LOG_ERR, "rtmp_replace: %m");
+ syslog(LOG_ERR, "rtmp_replace: %s", strerror(errno));
atalkd_exit(1);
}
if (cc) {
} else {
rtmp->rt_hops = RTMPHOPS_POISON;
if ((cc = rtmp_replace( rtmp )) < 0) {
- syslog(LOG_ERR, "rtmp_replace: %m");
+ syslog(LOG_ERR, "rtmp_replace: %s", strerror(errno));
atalkd_exit(1);
}
if (cc)
if ( sendto( zap->ap_fd, packet, cc, 0,
(struct sockaddr *)&sat,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "as_timer sendto: %m" );
+ syslog( LOG_ERR, "as_timer sendto: %s", strerror(errno) );
}
sentzipq = 1;
if ( sendto( zap->ap_fd, packet, cc, 0, (struct sockaddr *)&sat,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "as_timer sendto: %m" );
+ syslog( LOG_ERR, "as_timer sendto: %s", strerror(errno) );
}
}
}
if ( sendto( rap->ap_fd, packet, data - packet, 0,
(struct sockaddr *)&sat,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "as_timer sendto %u.%u (%u): %m",
+ syslog( LOG_ERR, "as_timer sendto %u.%u (%u): %s",
ntohs( sat.sat_addr.s_net ),
sat.sat_addr.s_node,
- ntohs( iface->i_rt->rt_firstnet ));
+ ntohs( iface->i_rt->rt_firstnet ),
+ strerror(errno) );
}
if ( iface->i_flags & IFACE_PHASE2 ) {
if ( sendto( rap->ap_fd, packet, data - packet, 0,
(struct sockaddr *)&sat,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "as_timer sendto %u.%u (%u): %m",
+ syslog( LOG_ERR, "as_timer sendto %u.%u (%u): %s",
ntohs( sat.sat_addr.s_net ),
sat.sat_addr.s_node,
- ntohs( iface->i_rt->rt_firstnet ));
+ ntohs( iface->i_rt->rt_firstnet ),
+ strerror(errno) );
}
}
}
FILE *rtmpdebug;
if (( rtmpdebug = fopen( _PATH_ATALKDEBUG, "w" )) == NULL ) {
- syslog( LOG_ERR, "rtmp: %m" );
+ syslog( LOG_ERR, "rtmp: %s", strerror(errno) );
}
for ( iface = interfaces; iface; iface = iface->i_next ) {
for ( rt = gate->g_rt; rt; rt = rt->rt_next ) {
if ( rt->rt_iprev ) {
if ( gateroute( RTMP_DEL, rt ) < 0 ) {
- syslog( LOG_ERR, "as_down remove %u-%u failed: %m",
+ syslog( LOG_ERR, "as_down remove %u-%u failed: %s",
ntohs( rt->rt_firstnet ),
- ntohs( rt->rt_lastnet ));
+ ntohs( rt->rt_lastnet ),
+ strerror(errno) );
}
}
}
}
if ( iface->i_flags & IFACE_LOOP ) {
if (looproute( iface, RTMP_DEL )) {
- syslog( LOG_ERR, "as_down remove %s %u.%u failed: %m",
+ syslog( LOG_ERR, "as_down remove %s %u.%u failed: %s",
iface->i_name, ntohs( iface->i_addr.sat_addr.s_net ),
- iface->i_addr.sat_addr.s_node );
+ iface->i_addr.sat_addr.s_node,
+ strerror(errno) );
}
}
}
*/
#ifdef BSD4_4
if (( rtfd = socket( PF_ROUTE, SOCK_RAW, AF_APPLETALK )) < 0 ) {
- syslog( LOG_ERR, "route socket: %m" );
+ syslog( LOG_ERR, "route socket: %s", strerror(errno) );
atalkd_exit( 1 );
}
if ( shutdown( rtfd, 0 ) < 0 ) {
- syslog( LOG_ERR, "route shutdown: %m" );
+ syslog( LOG_ERR, "route shutdown: %s", strerror(errno) );
atalkd_exit( 1 );
}
#else /* BSD4_4 */
if (( rtfd = socket( AF_APPLETALK, SOCK_DGRAM, 0 )) < 0 ) {
- syslog( LOG_ERR, "route socket: %m" );
+ syslog( LOG_ERR, "route socket: %s", strerror(errno) );
atalkd_exit( 1 );
}
#endif /* BSD4_4 */
sigaddset( &sv.sa_mask, SIGTERM );
sv.sa_flags = SA_RESTART;
if ( sigaction( SIGTERM, &sv, NULL) < 0 ) {
- syslog( LOG_ERR, "sigterm: %m" );
+ syslog( LOG_ERR, "sigterm: %s", strerror(errno) );
atalkd_exit( 1 );
}
sigaddset( &sv.sa_mask, SIGTERM );
sv.sa_flags = SA_RESTART;
if ( sigaction( SIGUSR1, &sv, NULL) < 0 ) {
- syslog( LOG_ERR, "sigusr1: %m" );
+ syslog( LOG_ERR, "sigusr1: %s", strerror(errno) );
atalkd_exit( 1 );
}
sigaddset( &sv.sa_mask, SIGTERM );
sv.sa_flags = SA_RESTART;
if ( sigaction( SIGALRM, &sv, NULL) < 0 ) {
- syslog( LOG_ERR, "sigalrm: %m" );
+ syslog( LOG_ERR, "sigalrm: %s", strerror(errno) );
atalkd_exit( 1 );
}
it.it_value.tv_sec = 10L;
it.it_value.tv_usec = 0L;
if ( setitimer( ITIMER_REAL, &it, NULL) < 0 ) {
- syslog( LOG_ERR, "setitimer: %m" );
+ syslog( LOG_ERR, "setitimer: %s", strerror(errno) );
atalkd_exit( 1 );
}
errno = 0;
continue;
} else {
- syslog( LOG_ERR, "select: %m" );
+ syslog( LOG_ERR, "select: %s", strerror(errno) );
atalkd_exit( 1 );
}
}
fromlen = sizeof( struct sockaddr_at );
if (( c = recvfrom( ap->ap_fd, Packet, sizeof( Packet ),
0, (struct sockaddr *)&sat, &fromlen )) < 0 ) {
- syslog( LOG_ERR, "recvfrom: %m" );
+ syslog( LOG_ERR, "recvfrom: %s", strerror(errno) );
continue;
}
#ifdef DEBUG
#endif /* DEBUG */
#ifdef __svr4__
if ( sighold( SIGALRM ) || sighold( SIGUSR1 )) {
- syslog( LOG_ERR, "sighold: %m" );
+ syslog( LOG_ERR, "sighold: %s", strerror(errno) );
atalkd_exit( 1 );
}
#else /* __svr4__ */
sigmask( SIGUSR1 ));
#endif /* __svr4__ */
if (( *ap->ap_packet )( ap, &sat, Packet, c ) < 0) {
- syslog(LOG_ERR, "ap->ap_packet: %m");
+ syslog(LOG_ERR, "ap->ap_packet: %s", strerror(errno));
atalkd_exit(1);
}
#endif /* DEBUG */
#ifdef __svr4__
if ( sigrelse( SIGUSR1 ) || sigrelse( SIGALRM )) {
- syslog( LOG_ERR, "sigrelse: %m" );
+ syslog( LOG_ERR, "sigrelse: %s", strerror(errno) );
atalkd_exit( 1 );
}
#else /* __svr4__ */
}
} else if (rtmp_request( iface ) < 0) {
- syslog(LOG_ERR, "bootaddr (rtmp_request): %m");
+ syslog(LOG_ERR, "bootaddr (rtmp_request): %s", strerror(errno));
atalkd_exit(1);
}
}
} else if (zip_getnetinfo( iface ) < 0) {
- syslog(LOG_ERR, "bootaddr (zip_getnetinfo): %m");
+ syslog(LOG_ERR, "bootaddr (zip_getnetinfo): %s", strerror(errno));
atalkd_exit(1);
}
}
* Change setaddr()
* to manage the i_ports field and the fds for select().
*/
-void setaddr( iface, phase, net, node, first, last )
- struct interface *iface;
- u_int8_t phase;
- u_int16_t net;
- u_int8_t node;
- u_int16_t first, last;
+void setaddr(struct interface *iface,
+ u_int8_t phase, u_int16_t net, u_int8_t node,
+ u_int16_t first, u_int16_t last)
{
int i;
struct atserv *as;
}
if (( ap = (struct atport *)malloc( sizeof( struct atport ))) ==
NULL ) {
- syslog( LOG_ERR, "malloc: %m" );
+ syslog( LOG_ERR, "malloc: %s", strerror(errno) );
atalkd_exit( 1 );
}
ap->ap_fd = 0;
memcpy( iface->i_addr.sat_zero, &nr, sizeof( struct netrange ));
if ( ifconfig( iface->i_name, SIOCSIFADDR, &iface->i_addr )) {
- syslog( LOG_ERR, "setifaddr: %s (%u-%u): %m. try specifying a \
-smaller net range.", iface->i_name, ntohs(first), ntohs(last));
+ syslog( LOG_ERR, "setifaddr: %s (%u-%u): %s. try specifying a \
+smaller net range.", iface->i_name, ntohs(first), ntohs(last), strerror(errno));
atalkd_exit( 1 );
}
if ( ifconfig( iface->i_name, SIOCGIFADDR, &iface->i_addr )) {
- syslog( LOG_ERR, "getifaddr: %s: %m", iface->i_name );
+ syslog( LOG_ERR, "getifaddr: %s: %s", iface->i_name, strerror(errno) );
atalkd_exit( 1 );
}
#endif /* __svr4__ */
for ( ap = iface->i_ports; ap; ap = ap->ap_next ) {
if (( ap->ap_fd = socket( AF_APPLETALK, SOCK_DGRAM, 0 )) < 0 ) {
- syslog( LOG_ERR, "socket: %m" );
+ syslog( LOG_ERR, "socket: %s", strerror(errno) );
atalkd_exit( 1 );
}
#ifndef __svr4__
if ( bind( ap->ap_fd, (struct sockaddr *)&sat,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "bind %u.%u:%u: %m",
+ syslog( LOG_ERR, "bind %u.%u:%u: %s",
ntohs( sat.sat_addr.s_net ),
- sat.sat_addr.s_node, sat.sat_port );
+ sat.sat_addr.s_node, sat.sat_port, strerror(errno) );
#ifdef SIOCDIFADDR
/* remove all interfaces if we have a problem with bind */
for (iface = interfaces; iface; iface = iface->i_next) {
/*
- * $Id: multicast.c,v 1.7 2001-08-15 01:39:39 srittau Exp $
+ * $Id: multicast.c,v 1.8 2001-12-10 20:16:55 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/ioctl.h>
if (!zt->zt_bcast &&
(zt->zt_bcast = (u_char *) malloc(sizeof( ethermulti ))) == NULL) {
- syslog( LOG_ERR, "zone_bcast malloc: %m" );
+ syslog( LOG_ERR, "zone_bcast malloc: %s", strerror(errno) );
return -1;
}
/*
- * $Id: nbp.c,v 1.5 2001-08-15 01:39:39 srittau Exp $
+ * $Id: nbp.c,v 1.6 2001-12-10 20:16:55 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
#include <sys/syslog.h>
#include <sys/types.h>
#include <sys/param.h>
data += SZ_NBPHDR;
if ( sendto( fd, packet, data - packet, 0, (struct sockaddr *)to,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "sendto: %m" );
+ syslog( LOG_ERR, "sendto: %s", strerror(errno) );
}
}
if ( zt == (struct ziptab *)l->l_data ) {
/* add multicast */
if (addmulti(iface->i_name, zt->zt_bcast) < 0) {
- syslog( LOG_ERR, "nbp_packet: addmulti: %m" );
+ syslog( LOG_ERR, "nbp_packet: addmulti: %s",
+ strerror(errno) );
return -1;
}
}
if (( ntab = (struct nbptab *)malloc( sizeof( struct nbptab )))
== 0 ) {
- syslog( LOG_ERR, "nbp_packet: malloc: %m" );
+ syslog( LOG_ERR, "nbp_packet: malloc: %s", strerror(errno) );
return -1;
}
memcpy( &ntab->nt_nve, &nn, sizeof( struct nbpnve ));
if ( sendto( ap->ap_fd, data - len, len, 0, (struct sockaddr *)&sat,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "nbp brrq sendto: %m" );
+ syslog( LOG_ERR, "nbp brrq sendto: %s", strerror(errno) );
}
locallkup = 1;
if ( sendto( ap->ap_fd, data - len, len, 0,
(struct sockaddr *)&sat,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "nbp brrq sendto %u.%u: %m",
- ntohs( sat.sat_addr.s_net ), sat.sat_addr.s_node );
+ syslog( LOG_ERR, "nbp brrq sendto %u.%u: %s",
+ ntohs( sat.sat_addr.s_net ), sat.sat_addr.s_node,
+ strerror(errno) );
continue;
}
}
from->sat_addr.s_node = ATADDR_BCAST;
if ( sendto( ap->ap_fd, data - len, len, 0, (struct sockaddr *)from,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "nbp fwd sendto %u.%u: %m",
- ntohs( from->sat_addr.s_net ), from->sat_addr.s_node );
+ syslog( LOG_ERR, "nbp fwd sendto %u.%u: %s",
+ ntohs( from->sat_addr.s_net ), from->sat_addr.s_node,
+ strerror(errno) );
return 0;
}
}
if ( sendto( ap->ap_fd, packet, cc, 0,
(struct sockaddr *)&nn.nn_sat,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "nbp lkup sendto %u.%u: %m",
+ syslog( LOG_ERR, "nbp lkup sendto %u.%u: %s",
ntohs( nn.nn_sat.sat_addr.s_net ),
- nn.nn_sat.sat_addr.s_node );
+ nn.nn_sat.sat_addr.s_node,
+ strerror(errno) );
return 0;
}
if ( sendto( ap->ap_fd, packet, cc, 0,
(struct sockaddr *)&nn.nn_sat,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "nbp lkup sendto %u.%u: %m",
+ syslog( LOG_ERR, "nbp lkup sendto %u.%u: %s",
ntohs( nn.nn_sat.sat_addr.s_net ),
- nn.nn_sat.sat_addr.s_node );
+ nn.nn_sat.sat_addr.s_node,
+ strerror(errno) );
return 0;
}
}
/*
- * $Id: rtmp.c,v 1.8 2001-08-15 01:39:39 srittau Exp $
+ * $Id: rtmp.c,v 1.9 2001-12-10 20:16:55 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
#include <sys/syslog.h>
#include <sys/types.h>
#include <sys/param.h>
return -1;
if (cc) {
- syslog( LOG_ERR, "rtmp_config: can't route %u.%u to loopback: %m",
+ syslog( LOG_ERR, "rtmp_config: can't route %u.%u to loopback: %s",
ntohs( iface->i_addr.sat_addr.s_net ),
- iface->i_addr.sat_addr.s_node );
+ iface->i_addr.sat_addr.s_node,
+ strerror(errno) );
}
syslog( LOG_INFO, "rtmp_config configured %s", iface->i_name );
}
if (cc)
- syslog( LOG_ERR, "rtmp_packet: can't remove loopback: %m" );
+ syslog( LOG_ERR, "rtmp_packet: can't remove loopback: %s",
+ strerror(errno) );
iface->i_flags &= ~IFACE_NOROUTER;
iface->i_time = 0;
}
if ( !gate ) { /* new gateway */
if (( gate = (struct gate *)malloc( sizeof( struct gate ))) == 0 ) {
- syslog( LOG_ERR, "rtmp_packet: malloc: %m" );
+ syslog( LOG_ERR, "rtmp_packet: malloc: %s", strerror(errno) );
return -1;
}
gate->g_next = iface->i_gate;
ntohs( rt.rt_net ));
} else { /* new for router */
if (( rtmp = newrt(iface)) == NULL ) {
- syslog( LOG_ERR, "rtmp_packet: newrt: %m" );
+ syslog( LOG_ERR, "rtmp_packet: newrt: %s", strerror(errno) );
return -1;
}
rtmp->rt_firstnet = rt.rt_net;
if ( sendto( ap->ap_fd, packet, data - packet, 0,
(struct sockaddr *)from,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "as_timer sendto: %m" );
+ syslog( LOG_ERR, "as_timer sendto: %s", strerror(errno) );
}
} else if ( *data == 2 || *data == 3 ) {
#ifdef DEBUG
sat.sat_port = ap->ap_port;
if ( sendto( ap->ap_fd, packet, data - packet, 0, (struct sockaddr *)&sat,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "rtmp_request sendto: %m" );
+ syslog( LOG_ERR, "rtmp_request sendto: %s", strerror(errno) );
return -1;
}
return 0;
(struct sockaddr *) &dst,
(struct sockaddr *) &gate,
RTF_UP | RTF_GATEWAY )) {
- syslog( LOG_ERR, "route: %u -> %u.%u: %m", net,
- ntohs( gate.sat_addr.s_net ), gate.sat_addr.s_node );
+ syslog( LOG_ERR, "route: %u -> %u.%u: %s", net,
+ ntohs( gate.sat_addr.s_net ), gate.sat_addr.s_node,
+ strerror(errno) );
continue;
}
#else /* ! BSD4_4 */
/*
- * $Id: zip.c,v 1.7 2001-08-15 01:39:39 srittau Exp $
+ * $Id: zip.c,v 1.8 2001-12-10 20:16:55 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/syslog.h>
if ( sendto( ap->ap_fd, packet, reply - packet, 0,
(struct sockaddr *)from,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "zip reply sendto: %m" );
+ syslog( LOG_ERR, "zip reply sendto: %s",
+ strerror(errno) );
}
reply = packet + 3;
if ( sendto( ap->ap_fd, packet, reply - packet,
0, (struct sockaddr *)from,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "zip reply sendto: %m" );
+ syslog( LOG_ERR, "zip reply sendto: %s",
+ strerror(errno) );
}
reply = packet + 3;
if ( sendto( ap->ap_fd, packet, reply - packet, 0,
(struct sockaddr *)from,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "zip reply sendto: %m" );
+ syslog( LOG_ERR, "zip reply sendto: %s",
+ strerror(errno) );
}
reply = packet + 3;
if ( sendto( ap->ap_fd, packet, reply - packet, 0,
(struct sockaddr *)from,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "zip reply sendto: %m" );
+ syslog( LOG_ERR, "zip reply sendto: %s",
+ strerror(errno) );
}
}
break;
if ( sendto( ap->ap_fd, packet, data - packet, 0,
(struct sockaddr *)from,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "zip gni sendto %u.%u: %m",
- ntohs( from->sat_addr.s_net ), from->sat_addr.s_node );
+ syslog( LOG_ERR, "zip gni sendto %u.%u: %s",
+ ntohs( from->sat_addr.s_net ), from->sat_addr.s_node,
+ strerror(errno) );
return 1;
}
break;
/* add addr to loopback route */
if ( looproute( iface, RTMP_ADD )) { /* -1 or 1 */
syslog( LOG_ERR,
- "zip_packet: can't route %u.%u to loopback: %m",
+ "zip_packet: can't route %u.%u to loopback: %s",
ntohs( iface->i_addr.sat_addr.s_net ),
- iface->i_addr.sat_addr.s_node );
+ iface->i_addr.sat_addr.s_node,
+ strerror(errno) );
return -1;
}
if ( sendto( ap->ap_fd, packet, data - packet, 0,
(struct sockaddr *)from,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "zip atp sendto %u.%u: %m",
- ntohs( from->sat_addr.s_net ), from->sat_addr.s_node );
+ syslog( LOG_ERR, "zip atp sendto %u.%u: %s",
+ ntohs( from->sat_addr.s_net ), from->sat_addr.s_node,
+ strerror(errno) );
return 1;
}
}
if ( sendto( ap->ap_fd, packet, data - packet, 0, (struct sockaddr *)&sat,
sizeof( struct sockaddr_at )) < 0 ) {
- syslog( LOG_ERR, "zip_getnetinfo sendto: %m" );
+ syslog( LOG_ERR, "zip_getnetinfo sendto: %s", strerror(errno) );
return -1;
}
return 0;
}
}
if (( l = (struct list *)malloc( sizeof( struct list ))) == NULL ) {
- syslog( LOG_ERR, "add_list malloc: %m" );
+ syslog( LOG_ERR, "add_list malloc: %s", strerror(errno) );
return -1;
}
}
if ( zt == NULL ) {
if (( zt = newzt( len, zone )) == NULL ) {
- syslog( LOG_ERR, "addzone newzt: %m" );
+ syslog( LOG_ERR, "addzone newzt: %s", strerror(errno) );
return -1;
}
if ( ziptab == NULL ) {
/*
- * $Id: netddp_open.c,v 1.4 2001-11-25 21:55:10 srittau Exp $
+ * $Id: netddp_open.c,v 1.5 2001-12-10 20:16:43 srittau Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1991 Regents of The University of Michigan.
bridge->sat_port = baddress.socket;
}
#else /* MACOSX_SERVER */
- int len;
+ socklen_t len;
if ((s = socket( AF_APPLETALK, SOCK_DGRAM, 0 )) < 0)
return -1;