}
p = strtok(NULL, ",");
}
+ return 0;
}
/* get rid of all of the uams */
char *comcont = "%%+";
-compop()
+void compop( void )
{
struct comstate *cs;
free( cs );
}
-compush( comment )
+void compush( comment )
struct papd_comment *comment;
{
struct comstate *cs;
comstate = cs;
}
-comswitch( comments, handler )
+int comswitch( comments, handler )
struct papd_comment *comments;
int (*handler)();
{
return( 0 );
}
-comcmp( start, stop, str, how )
+int comcmp( start, stop, str, how )
char *start, *stop, *str;
int how;
{
len = stop - start;
cc = strlen( str );
if ( how & C_FULL ) {
- if ( cc == len & strncmp( str, start, cc ) == 0 ) {
+ if ( (cc == len) && (strncmp( str, start, cc ) == 0) ) {
return( 0 );
}
} else {
- if ( cc <= len && strncmp( str, start, cc ) == 0 ) {
+ if ( (cc <= len) && (strncmp( str, start, cc ) == 0) ) {
return( 0 );
}
}
return( 1 );
}
- struct papd_comment *
-commatch( start, stop, comments )
+struct papd_comment *commatch( start, stop, comments )
char *start, *stop;
struct papd_comment comments[];
{
}
}
- char *
-comtoken( start, stop, pos, delim )
+char *comtoken( start, stop, pos, delim )
char *start, *stop, *pos, *delim;
{
if ( pos < start || pos > stop ) {
* All Rights Reserved. See COPYRIGHT.
*/
+#ifndef PAPD_COMMENT_H
+#define PAPD_COMMENT_H 1
+
struct papd_comment {
char *c_begin;
char *c_end;
* Magic "number" subtypes.
*/
#define CM_NOPRINT (1<<16) /* or print */
+
+void compop __P(( void ));
+void compush __P(( struct papd_comment * ));
+int comswitch __P(( struct papd_comment *, int (*)() ));
+int comcmp __P(( char *, char *, char *, int ));
+struct papd_comment *commatch __P(( char *, char *, struct papd_comment * ));
+char *comtoken __P(( char *, char *, char *, char * ));
+
+#endif /* PAPD_COMMENT_H */
#include "file.h"
-markline( pf, start, linelength, crlflength )
+int markline( pf, start, linelength, crlflength )
char **start;
int *linelength, *crlflength;
struct papfile *pf;
return *linelength;
}
-morespace( pf, data, len )
+void morespace( pf, data, len )
struct papfile *pf;
char *data;
int len;
}
-append(pf, data, len)
+void append(pf, data, len)
struct papfile *pf;
- char *data;
+ const char *data;
int len;
{
if ((pf->pf_data + pf->pf_datalen + len) >
(pf->pf_buf + pf->pf_bufsize)) {
morespace(pf, data, len);
} else {
- bcopy(data, pf->pf_data + pf->pf_datalen, len);
+ memcpy(pf->pf_data + pf->pf_datalen, data, len);
pf->pf_datalen += len;
}
}
-spoolerror( out, str )
+void spoolerror( out, str )
struct papfile *out;
char *str;
{
* All Rights Reserved. See COPYRIGHT.
*/
+#ifndef PAPD_FILE_H
+#define PAPD_FILE_H 1
+
struct papfile {
int pf_state;
struct state *pf_xstate;
}
#define PF_MORESPACE 1024
+
+int markline __P(( struct papfile *, char **, int *, int * ));
+void morespace __P(( struct papfile *, char *, int ));
+void append __P(( struct papfile *, const char *, int ));
+void spoolerror __P(( struct papfile *, char * ));
+
+#endif /* PAPD_FILE_H */
#include "file.h"
#include "comment.h"
+#include "lp.h"
-ch_title( in, out )
+int ch_title( struct papfile *, struct papfile * );
+
+int ch_title( in, out )
struct papfile *in, *out;
{
char *start, *stop, *p, *q, c;
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <ctype.h>
+#include <unistd.h>
+
#if defined( sun ) && defined( __svr4__ )
#include </usr/ucbinclude/sys/file.h>
#else sun __svr4__
#include "printer.h"
#include "file.h"
+#include "lp.h"
+
+/* These functions aren't used outside of lp.c */
+int lp_conn_inet();
+int lp_disconn_inet( int );
+int lp_conn_unix();
+int lp_disconn_unix( int );
char hostname[ MAXHOSTNAMELEN ];
extern struct sockaddr_at *sat;
-/* initialize printing interface */
-int lp_init();
-/* cancel current job */
-int lp_cancel();
-/* print current job */
-int lp_print();
-
-/* open a file for spooling */
-int lp_open();
-/* open a buffer to the current open file */
-int lp_write();
-/* close current spooling file */
-int lp_close();
-
struct lp {
int lp_flags;
FILE *lp_stream;
#define LP_CONNECT (1<<3)
#define LP_QUEUE (1<<4)
-lp_person( person )
+void lp_person( person )
char *person;
{
if ( lp.lp_person != NULL ) {
}
#ifdef ABS_PRINT
-lp_pagecost()
+int lp_pagecost()
{
char cost[ 22 ];
char balance[ 22 ];
}
#endif ABS_PRINT
-lp_host( host )
+void lp_host( host )
char *host;
{
if ( lp.lp_host != NULL ) {
strcpy( lp.lp_host, host );
}
-lp_job( job )
+void lp_job( job )
char *job;
{
char *p, *q;
*q = '\0';
}
-lp_init( out, sat )
+int lp_init( out, sat )
struct papfile *out;
struct sockaddr_at *sat;
{
return( 0 );
}
-lp_open( out, sat )
+int lp_open( out, sat )
struct papfile *out;
struct sockaddr_at *sat;
{
return( 0 );
}
-lp_close()
+int lp_close()
{
if (( lp.lp_flags & LP_INIT ) == 0 || ( lp.lp_flags & LP_OPEN ) == 0 ) {
- return;
+ return 0;
}
fclose( lp.lp_stream );
lp.lp_stream = NULL;
lp.lp_flags &= ~LP_OPEN;
- return;
+ return 0;
}
-lp_write( buf, len )
+int lp_write( buf, len )
char *buf;
int len;
{
return( 0 );
}
-lp_cancel()
+int lp_cancel()
{
char name[ MAXPATHLEN ];
char letter;
if (( lp.lp_flags & LP_INIT ) == 0 || lp.lp_letter == 'A' ) {
- return;
+ return 0;
}
if ( lp.lp_flags & LP_OPEN ) {
}
}
- return;
+ return 0;
}
/*
*
* XXX piped?
*/
-lp_print()
+int lp_print()
{
char buf[ MAXPATHLEN ];
char tfname[ MAXPATHLEN ];
FILE *cfile;
if (( lp.lp_flags & LP_INIT ) == 0 || lp.lp_letter == 'A' ) {
- return;
+ return 0;
}
lp_close();
sprintf( tfname, "tfA%03d%s", lp.lp_seq, hostname );
if (( fd = open( tfname, O_WRONLY|O_EXCL|O_CREAT, 0660 )) < 0 ) {
syslog( LOG_ERR, "lp_print %s: %m", tfname );
- return;
+ return 0;
}
if (( cfile = fdopen( fd, "w" )) == NULL ) {
syslog( LOG_ERR, "lp_print %s: %m", tfname );
- return;
+ return 0;
}
fprintf( cfile, "H%s\n", hostname ); /* XXX lp_host? */
if ( link( tfname, cfname ) < 0 ) {
syslog( LOG_ERR, "lp_print can't link %s to %s: %m", cfname,
tfname );
- return;
+ return 0;
}
unlink( tfname );
if (( s = lp_conn_unix()) < 0 ) {
syslog( LOG_ERR, "lp_print: lp_conn_unix: %m" );
- return;
+ return 0;
}
sprintf( buf, "\1%s\n", printer->p_printer );
n = strlen( buf );
if ( write( s, buf, n ) != n ) {
syslog( LOG_ERR, "lp_print write: %m" );
- return;
+ return 0;
}
if ( read( s, buf, 1 ) != 1 ) {
syslog( LOG_ERR, "lp_print read: %m" );
- return;
+ return 0;
}
lp_disconn_unix( s );
if ( buf[ 0 ] != '\0' ) {
syslog( LOG_ERR, "lp_print lpd said %c: %m", buf[ 0 ] );
- return;
+ return 0;
}
}
syslog( LOG_INFO, "lp_print queued" );
- return;
+ return 0;
}
-lp_disconn_unix( fd )
+int lp_disconn_unix( fd )
{
return( close( fd ));
}
-lp_conn_unix()
+int lp_conn_unix()
{
int s;
struct sockaddr_un saun;
return( s );
}
-lp_disconn_inet( fd )
+int lp_disconn_inet( int fd )
{
return( close( fd ));
}
-lp_conn_inet()
+int lp_conn_inet()
{
int privfd, port = IPPORT_RESERVED - 1;
struct sockaddr_in sin;
return( privfd );
}
-lp_rmjob( job )
+int lp_rmjob( job )
int job;
{
char buf[ 1024 ];
char *tag_size = "size: ";
char *tag_status = "status: ";
-lp_queue( out )
+int lp_queue( out )
struct papfile *out;
{
char buf[ 1024 ], *start, *stop, *p, *q;
--- /dev/null
+#ifndef PAPD_LP_H
+#define PAPD_LP_H 1
+
+#include <sys/socket.h>
+#include "file.h"
+
+void lp_person __P(( char * ));
+int lp_pagecost __P(( void ));
+void lp_host __P(( char * ));
+void lp_job __P(( char * ));
+int lp_rmjob __P(( int ));
+int lp_queue __P(( struct papfile * ));
+
+/* initialize printing interface */
+int lp_init __P(( struct papfile *, struct sockaddr_at * ));
+/* cancel current job */
+int lp_cancel __P(( void ));
+/* print current job */
+int lp_print __P(( void ));
+/* open a file for spooling */
+int lp_open __P(( struct papfile *, struct sockaddr_at * ));
+/* open a buffer to the current open file */
+int lp_write __P(( char *, int ));
+/* close current spooling file */
+int lp_close __P(( void ));
+
+#endif /* PAPD_LP_H */
#include <sys/param.h>
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include "file.h"
#include "comment.h"
+#include "lp.h"
-ps( infile, outfile, sat )
+int ps( infile, outfile, sat )
struct papfile *infile, *outfile;
struct sockaddr_at *sat;
{
struct papd_comment *comment;
for (;;) {
- if ( comment = compeek()) {
+ if ( (comment = compeek()) ) {
switch( (*comment->c_handler)( infile, outfile, sat )) {
case CH_DONE :
continue;
}
}
-cm_psquery( in, out, sat )
+int cm_psquery( in, out, sat )
struct papfile *in, *out;
struct sockaddr_at *sat;
{
}
}
-cm_psadobe( in, out, sat )
+int cm_psadobe( in, out, sat )
struct papfile *in, *out;
struct sockaddr_at *sat;
{
char *start;
int linelength, crlflength;
- struct comment *comment = compeek();
+ struct papd_comment *comment = compeek();
for (;;) {
switch ( markline( in, &start, &linelength, &crlflength )) {
char *Query = "Query";
-cm_psswitch( in, out, sat )
+int cm_psswitch( in, out, sat )
struct papfile *in, *out;
struct sockaddr_at *sat;
{
#include <atalk/pap.h>
#include <atalk/paths.h>
#include <atalk/util.h>
+#include <atalk/nbp.h>
#include "printer.h"
+#include "printcap.h"
+#include "session.h"
+#include "uam_auth.h"
#define _PATH_PAPDPPDFILE ".ppd"
char *uamlist;
char *uampath = _PATH_PAPDUAMPATH;
+/* Prototypes for locally used functions */
+int getstatus( struct printer *pr, char *buf );
+int rprintcap( struct printer *pr );
+void getprinters( char *cf );
+
+
/* this only needs to be used by the server process */
static void papd_exit(const int i)
{
int n;
{
struct printer *pr;
+ struct at_addr addr;
+
+ memset(&addr, 0, sizeof(addr));
for ( pr = printers; pr; pr = pr->p_next ) {
if ( pr->p_flags & P_REGISTERED ) {
- if ( nbp_unrgstr( pr->p_name, pr->p_type, pr->p_zone ) < 0 ) {
+ if ( nbp_unrgstr( pr->p_name, pr->p_type, pr->p_zone, &addr ) < 0 ) {
syslog( LOG_ERR, "can't unregister %s:%s@%s\n", pr->p_name,
pr->p_type, pr->p_zone );
papd_exit( n + 1 );
char rbuf[ 255 + 1 + 8 ];
-main( ac, av )
+int main( ac, av )
int ac;
char **av;
{
}
}
}
+ return 0;
}
/*
* We assume buf is big enough for 255 bytes of data and a length byte.
*/
- int
-getstatus( pr, buf )
+
+int getstatus( pr, buf )
struct printer *pr;
char *buf;
{
char *pgetstr();
char *getpname();
-getprinters( cf )
+void getprinters( cf )
char *cf;
{
char buf[ 1024 ], area[ 1024 ], *a, *p, *name, *type, *zone;
pr->p_flags |= P_AUTH_CAP;
} else { pr->p_authprintdir = NULL; }
- if ( pgetflag( "sp", &a ) == 1 ) {
+ if ( pgetflag( "sp" ) == 1 ) {
pr->p_flags |= P_AUTH;
pr->p_flags |= P_AUTH_PSSP;
}
}
}
-rprintcap( pr )
+int rprintcap( pr )
struct printer *pr;
{
char buf[ 1024 ], area[ 1024 ], *a, *p;
#ifndef SHOWPPD
int ppd_inited = 0;
-ppd_init()
+int ppd_init()
{
if ( ppd_inited ) {
return( -1 );
}
ppd_inited++;
- read_ppd( printer->p_ppdfile, 0 );
+ return read_ppd( printer->p_ppdfile, 0 );
}
#endif SHOWPPD
- struct ppdent *
-getppdent( stream )
+struct ppdent *getppdent( stream )
FILE *stream;
{
static char buf[ 1024 ];
}
q = p;
- while ( *p != ' ' && *p != '\t' && *p != ':' && *p != '\n' ) {
+ while ( (*p != ' ') && (*p != '\t') && (*p != ':') && (*p != '\n') ) {
p++;
}
- if ( *( q + 1 ) == '%' || *( q + 1 ) == '?' ) { /* comments & queries */
+ if ( (*( q + 1 ) == '%') || (*( q + 1 ) == '?') ) { /* comments & queries */
continue;
}
ppdent.pe_main = q;
if ( *p != ':' ) { /* option key word */
*p++ = '\0';
- while ( *p == ' ' || *p == '\t' ) {
+ while ( (*p == ' ') || (*p == '\t') ) {
p++;
}
q = p;
- while ( *p != ':' && *p != '/' && *p != '\n' ) {
+ while ( (*p != ':') && (*p != '/') && (*p != '\n') ) {
p++;
}
}
*p++ = '\0';
- while ( *p == ' ' || *p == '\t' ) {
+ while ( (*p == ' ') || (*p == '\t') ) {
p++;
}
return( NULL );
}
-read_ppd( file, fcnt )
+int read_ppd( file, fcnt )
char *file;
int fcnt;
{
break;
}
}
- if ( pfe->pd_name && pfe->pd_value == NULL ) {
+ if ( pfe->pd_name && (pfe->pd_value == NULL) ) {
if (( pfe->pd_value =
(char *)malloc( strlen( pe->pe_value ) + 1 )) == NULL ) {
syslog( LOG_ERR, "malloc: %m" );
return( 0 );
}
- struct ppd_font *
-ppd_font( font )
+struct ppd_font *ppd_font( font )
char *font;
{
struct ppd_font *pfo;
return( NULL );
}
- struct ppd_feature *
-ppd_feature( feature, len )
- char *feature;
+struct ppd_feature *ppd_feature( feature, len )
+ const char *feature;
int len;
{
struct ppd_feature *pfe;
- char main[ 256 ];
- char *end, *p, *q;
+ char ppd_feature_main[ 256 ];
+ const char *end, *p;
+ char *q;
#ifndef SHOWPPD
if ( ! ppd_inited ) {
}
#endif SHOWPPD
- for ( end = feature + len, p = feature, q = main;
- p <= end && *p != '\n' && *p != '\r'; p++, q++ ) {
+ for ( end = feature + len, p = feature, q = ppd_feature_main;
+ (p <= end) && (*p != '\n') && (*p != '\r'); p++, q++ ) {
*q = *p;
}
if ( p > end ) {
*q = '\0';
for ( pfe = ppd_features; pfe->pd_name; pfe++ ) {
- if ( strcmp( pfe->pd_name, main ) == 0 && pfe->pd_value ) {
+ if ( (strcmp( pfe->pd_name, ppd_feature_main ) == 0) && pfe->pd_value ) {
return( pfe );
}
}
* Copyright (c) 1995 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*/
+#ifndef PAPD_PPD_H
+#define PAPD_PPD_H 1
struct ppd_font {
char *pd_font;
char *pd_value;
};
-struct ppd_feature *ppd_feature();
-struct ppd_font *ppd_font();
+struct ppd_feature *ppd_feature __P((const char *, int));
+struct ppd_font *ppd_font __P((char *));
+int read_ppd __P((char *, int));
+int ppd_init __P(( void ));
+
+#endif /* PAPD_PPD_H */
#include <ctype.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <atalk/paths.h>
+#include "printcap.h"
+
#ifndef BUFSIZ
#define BUFSIZ 1024
#endif
* Added a "cap" parameter, so we can use these calls for printcap
* and papd.conf.
*/
-getprent( cap, bp)
+int getprent( cap, bp)
register char *cap;
register char *bp;
{
}
}
-endprent()
+void endprent()
{
if (pfp != NULL)
fclose(pfp);
* Added a "cap" parameter, so we can use these calls for printcap
* and papd.conf.
*/
-tgetent( cap, bp, name)
+int tgetent( cap, bp, name)
char *cap, *bp, *name;
{
register char *cp;
*/
if (tnamatch(name)) {
close(tf);
- return(tnchktc());
+ return(tnchktc(cap));
}
}
}
* Added a "cap" parameter, so we can use these calls for printcap
* and papd.conf.
*/
-tnchktc( cap )
+int tnchktc( cap )
char *cap;
{
register char *p, *q;
* against each such name. The normal : terminator after the last
* name (before the first field) stops us.
*/
-tnamatch(np)
+int tnamatch(np)
char *np;
{
register char *Np, *Bp;
* a # character. If the option is not found we return -1.
* Note that we handle octal numbers beginning with 0.
*/
-tgetnum(id)
+int tgetnum(id)
char *id;
{
register int i, base;
* of the buffer. Return 1 if we find the option, or 0 if it is
* not given.
*/
-tgetflag(id)
+int tgetflag(id)
char *id;
{
register char *bp = tbuf;
--- /dev/null
+#ifndef PAPD_PRINTCAP_H
+#define PAPD_PRINTCAP_H 1
+
+int getprent __P(( register char *, register char * ));
+int pnchktc __P(( char * ));
+int pgetflag __P(( char * ));
+void endprent __P(( void ));
+int pgetent __P(( char *, char *, char * ));
+int pgetnum __P(( char * ));
+int pnamatch __P(( char * ));
+
+#endif /* PAPD_PRINTCAP_H */
#endif
#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <sys/syslog.h>
#include <sys/param.h>
#include <sys/time.h>
#include "comment.h"
#include "printer.h"
#include "ppd.h"
+#include "lp.h"
#include "uam_auth.h"
-cq_default( in, out )
+int cq_default( struct papfile *, struct papfile * );
+int cq_k4login( struct papfile *, struct papfile * );
+int cq_uameth( struct papfile *, struct papfile * );
+
+int gq_balance( struct papfile * );
+int gq_pagecost( struct papfile * );
+int gq_true( struct papfile * );
+int gq_rbispoolerid( struct papfile * );
+int gq_rbiuamlist( struct papfile * );
+
+int cq_query( struct papfile *, struct papfile * );
+void cq_font_answer( char *, char *, struct papfile * );
+int cq_font( struct papfile *, struct papfile * );
+int cq_feature( struct papfile *, struct papfile * );
+int cq_printer( struct papfile *, struct papfile * );
+int cq_rmjob( struct papfile *, struct papfile * );
+int cq_listq( struct papfile *, struct papfile * );
+int cq_rbilogin( struct papfile *, struct papfile * );
+
+
+
+int cq_default( in, out )
struct papfile *in, *out;
{
char *start, *stop, *p;
#define h2b(x) (isdigit((x))?(x)-'0':(isupper((x))?(x)-'A':(x)-'a')+10)
-cq_k4login( in, out )
+int cq_k4login( in, out )
struct papfile *in, *out;
{
char *start, *p;
char *uameth = "UMICHKerberosIV\n*\n";
-cq_uameth( in, out )
+int cq_uameth( in, out )
struct papfile *in, *out;
{
char *start;
}
#endif KRB
-gq_true( out )
+int gq_true( out )
struct papfile *out;
{
if ( printer->p_flags & P_SPOOLED ) {
}
}
-gq_pagecost( out )
+int gq_pagecost( out )
struct papfile *out;
{
char cost[ 60 ];
}
#ifdef ABS_PRINT
-gq_balance( out )
+int gq_balance( out )
struct papfile *out;
{
char balance[ 60 ];
static const char *spoolerid = "(PAPD Spooler) 2.1 (2.1.4 pre-release)\n";
-gq_rbispoolerid( out )
+int gq_rbispoolerid( out )
struct papfile *out;
{
append( out, spoolerid, strlen( spoolerid ));
static const char *nouams = "*\n";
-gq_rbiuamlist( out )
+int gq_rbiuamlist( out )
struct papfile *out;
{
char uamnames[128] = "\0";
{ NULL },
};
-cq_query( in, out )
+int cq_query( in, out )
struct papfile *in, *out;
{
char *start, *stop, *p, *q;
}
}
-cq_font_answer( start, stop, out )
+void cq_font_answer( start, stop, out )
char *start, *stop;
struct papfile *out;
{
return;
}
-cq_font( in, out )
+int cq_font( in, out )
struct papfile *in, *out;
{
char *start, *stop, *p;
}
}
-cq_feature( in, out )
+int cq_feature( in, out )
struct papfile *in, *out;
{
char *start, *stop, *p;
static const char *psver = "*PSVersion\n";
static const char *prod = "*Product\n";
-cq_printer( in, out )
+int cq_printer( in, out )
struct papfile *in, *out;
{
char *start, *p;
static const char *rmjobfailed = "Failed\n";
static const char *rmjobok = "Ok\n";
-cq_rmjob( in, out )
+int cq_rmjob( in, out )
struct papfile *in, *out;
{
char *start, *stop, *p;
return( CH_DONE );
}
-cq_listq( in, out )
+int cq_listq( in, out )
struct papfile *in, *out;
{
char *start;
disabled ]%%\r%%Flushing: rest of job (to end-of-file) will be \
ignored ]%%\r";
-cq_rbilogin( in, out )
+int cq_rbilogin( in, out )
struct papfile *in, *out;
{
char *start, *stop, *p, *begin;
#include "config.h"
#endif
+#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/syslog.h>
#include <atalk/pap.h>
#include "file.h"
+#include "lp.h"
+#include "session.h"
extern unsigned char connid, quantum, oquantum;
* Read lines of a file, until the client sends eof, after
* which we'll send eof also.
*/
-session( atp, sat )
+int session( atp, sat )
ATP atp;
struct sockaddr_at *sat;
{
atpb.atp_sreqtries = -1; /* infinite retries */
if ( atp_sreq( atp, &atpb, oquantum, ATP_XO )) {
syslog( LOG_ERR, "atp_sreq: %m" );
- exit( 1 );
+ return( -1 );
}
for (;;) {
if (( cc = select( FD_SETSIZE, &fds, 0, 0, &tv )) < 0 ) {
syslog( LOG_ERR, "select: %m" );
- exit( 1 );
+ return( -1 );
}
if ( cc == 0 ) {
if ( timeout++ > 2 ) {
syslog( LOG_ERR, "connection timed out" );
lp_cancel();
- exit( 1 );
+ return( -1 );
}
/*
atpb.atp_sreqtries = 1; /* try once */
if ( atp_sreq( atp, &atpb, 0, 0 )) {
syslog( LOG_ERR, "atp_sreq: %m" );
- exit( 1 );
+ return( -1 );
}
continue;
} else {
timeout = 0;
}
- bzero( &ssat, sizeof( struct sockaddr_at ));
+ memset( &ssat, 0, sizeof( struct sockaddr_at ));
switch( atp_rsel( atp, &ssat, ATP_TRESP | ATP_TREQ )) {
case ATP_TREQ :
atpb.atp_saddr = &ssat;
atpb.atp_rreqdlen = sizeof( cbuf );
if ( atp_rreq( atp, &atpb ) < 0 ) {
syslog( LOG_ERR, "atp_rreq: %m" );
- exit( 1 );
+ return( -1 );
}
/* sanity */
if ( (unsigned char)cbuf[ 0 ] != connid ) {
syslog( LOG_ERR, "atp_sresp: %m" );
exit( 1 );
}
- exit( 0 );
+ return( 0 );
break;
case PAP_TICKLE :
atpb.atp_rresiovcnt = oquantum;
if ( atp_rresp( atp, &atpb ) < 0 ) {
syslog( LOG_ERR, "atp_rresp: %m" );
- exit( 1 );
+ return( -1 );
}
/* sanity */
/* move data */
if ( ps( &infile, &outfile, sat ) < 0 ) {
syslog( LOG_ERR, "parse: bad return" );
- exit( 1 ); /* really? close? */
+ return( -1 ); /* really? close? */
}
/*
cbuf[ 1 ] = PAP_READ;
if ( ++seq == 0 ) seq = 1;
netseq = htons( seq );
- bcopy( &netseq, &cbuf[ 2 ], sizeof( netseq ));
+ memcpy( &cbuf[ 2 ], &netseq, sizeof( netseq ));
atpb.atp_saddr = sat;
atpb.atp_sreqdata = cbuf;
atpb.atp_sreqdlen = 4; /* bytes in SendData request */
atpb.atp_sreqtries = -1; /* infinite retries */
if ( atp_sreq( atp, &atpb, oquantum, ATP_XO )) {
syslog( LOG_ERR, "atp_sreq: %m" );
- exit( 1 );
+ return( -1 );
}
break;
default :
syslog( LOG_ERR, "atp_rsel: %m" );
- exit( 1 );
+ return( -1 );
}
/* send any data that we have */
}
niov[ i ].iov_len = 4 + cc;
- bcopy( outfile.pf_data, niov[ i ].iov_base + 4, cc );
+ memcpy( niov[ i ].iov_base + 4, outfile.pf_data, cc );
CONSUME( &outfile, cc );
if ( outfile.pf_datalen == 0 ) {
i++;
atpb.atp_sresiovcnt = i; /* reported by stevebn@pc1.eos.co.uk */
if ( atp_sresp( atp, &atpb ) < 0 ) {
syslog( LOG_ERR, "atp_sresp: %m" );
- exit( 1 );
+ return( -1 );
}
readpending = 0;
}
--- /dev/null
+#ifndef PAPD_SESSION_H
+#define PAPD_SESSION_H 1
+
+#include <atalk/atp.h>
+
+int session( ATP atp, struct sockaddr_at *sat );
+
+#endif /* PAPD_SESSION_H */
setpwent();
while ((pwent = getpwent())) {
- if (user = strchr(pwent->pw_gecos, ','))
- *user = '\0';
+ if ((user = strchr(pwent->pw_gecos, ','))) *user = '\0';
user = pwent->pw_gecos;
/* check against both the gecos and the name fields. the user
#include <atalk/uam.h>
+#include "file.h"
+
struct uam_mod {
void *uam_module;
struct uam_export *uam_fcn;
#define auth_unregister(a) uam_detach(a)
struct uam_obj *auth_uamfind __P((const int, const char *, const int));
void auth_unload __P((void));
+int getuamnames __P((const int, char *));
#endif /* uam_auth.h */