Skip to content

Commit

Permalink
* in get_myaddress(); always return sockaddr_in containing localhost:…
Browse files Browse the repository at this point in the history
…PMAP_PORT.

  (as recommended in Weiste Venema's portmap5_beta distribution)
* deprecate register
* use memmove instead of bcopy
* KNF includes
* use err/warn() instead of perror/fprintf(stderr,)
* fix some typos
  • Loading branch information
lukem committed Feb 13, 1998
1 parent ce55551 commit f0a6859
Show file tree
Hide file tree
Showing 38 changed files with 598 additions and 536 deletions.
12 changes: 7 additions & 5 deletions lib/libc/rpc/auth_none.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: auth_none.c,v 1.8 1998/02/12 01:57:27 lukem Exp $ */
/* $NetBSD: auth_none.c,v 1.9 1998/02/13 05:52:11 lukem Exp $ */

/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
Expand Down Expand Up @@ -35,7 +35,7 @@
static char *sccsid = "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: auth_none.c,v 1.8 1998/02/12 01:57:27 lukem Exp $");
__RCSID("$NetBSD: auth_none.c,v 1.9 1998/02/13 05:52:11 lukem Exp $");
#endif
#endif

Expand All @@ -48,7 +48,9 @@ __RCSID("$NetBSD: auth_none.c,v 1.8 1998/02/12 01:57:27 lukem Exp $");
*/

#include "namespace.h"

#include <stdlib.h>

#include <rpc/types.h>
#include <rpc/xdr.h>
#include <rpc/auth.h>
Expand Down Expand Up @@ -86,9 +88,9 @@ static struct authnone_private {
AUTH *
authnone_create()
{
register struct authnone_private *ap = authnone_private;
struct authnone_private *ap = authnone_private;
XDR xdr_stream;
register XDR *xdrs;
XDR *xdrs;

if (ap == 0) {
ap = (struct authnone_private *)calloc(1, sizeof (*ap));
Expand Down Expand Up @@ -116,7 +118,7 @@ authnone_marshal(client, xdrs)
AUTH *client;
XDR *xdrs;
{
register struct authnone_private *ap = authnone_private;
struct authnone_private *ap = authnone_private;

if (ap == 0)
return (0);
Expand Down
57 changes: 29 additions & 28 deletions lib/libc/rpc/auth_unix.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: auth_unix.c,v 1.9 1998/02/12 01:57:28 lukem Exp $ */
/* $NetBSD: auth_unix.c,v 1.10 1998/02/13 05:52:13 lukem Exp $ */

/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
Expand Down Expand Up @@ -35,7 +35,7 @@
static char *sccsid = "@(#)auth_unix.c 1.19 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)auth_unix.c 2.2 88/08/01 4.0 RPCSRC";
#else
__RCSID("$NetBSD: auth_unix.c,v 1.9 1998/02/12 01:57:28 lukem Exp $");
__RCSID("$NetBSD: auth_unix.c,v 1.10 1998/02/13 05:52:13 lukem Exp $");
#endif
#endif

Expand All @@ -52,6 +52,8 @@ __RCSID("$NetBSD: auth_unix.c,v 1.9 1998/02/12 01:57:28 lukem Exp $");
*/

#include "namespace.h"

#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -108,30 +110,30 @@ authunix_create(machname, uid, gid, len, aup_gids)
char *machname;
int uid;
int gid;
register int len;
int len;
int *aup_gids;
{
struct authunix_parms aup;
char mymem[MAX_AUTH_BYTES];
struct timeval now;
XDR xdrs;
register AUTH *auth;
register struct audata *au;
AUTH *auth;
struct audata *au;

/*
* Allocate and set up auth handle
*/
auth = (AUTH *)mem_alloc(sizeof(*auth));
#ifndef KERNEL
if (auth == NULL) {
(void)fprintf(stderr, "authunix_create: out of memory\n");
warnx("authunix_create: out of memory");
return (NULL);
}
#endif
au = (struct audata *)mem_alloc(sizeof(*au));
#ifndef KERNEL
if (au == NULL) {
(void)fprintf(stderr, "authunix_create: out of memory\n");
warnx("authunix_create: out of memory");
return (NULL);
}
#endif
Expand Down Expand Up @@ -163,11 +165,11 @@ authunix_create(machname, uid, gid, len, aup_gids)
au->au_origcred.oa_base = mem_alloc((u_int) len);
#else
if ((au->au_origcred.oa_base = mem_alloc((u_int) len)) == NULL) {
(void)fprintf(stderr, "authunix_create: out of memory\n");
warnx("authunix_create: out of memory");
return (NULL);
}
#endif
bcopy(mymem, au->au_origcred.oa_base, (u_int)len);
memmove(au->au_origcred.oa_base, mymem, (size_t)len);

/*
* set auth handle to reflect new cred.
Expand All @@ -184,10 +186,10 @@ authunix_create(machname, uid, gid, len, aup_gids)
AUTH *
authunix_create_default()
{
register int len;
int len;
char machname[MAX_MACHINE_NAME + 1];
register int uid;
register int gid;
int uid;
int gid;
int gids[NGRPS];

if (gethostname(machname, MAX_MACHINE_NAME) == -1)
Expand Down Expand Up @@ -216,17 +218,17 @@ authunix_marshal(auth, xdrs)
AUTH *auth;
XDR *xdrs;
{
register struct audata *au = AUTH_PRIVATE(auth);
struct audata *au = AUTH_PRIVATE(auth);

return (XDR_PUTBYTES(xdrs, au->au_marshed, au->au_mpos));
}

static bool_t
authunix_validate(auth, verf)
register AUTH *auth;
AUTH *auth;
struct opaque_auth *verf;
{
register struct audata *au;
struct audata *au;
XDR xdrs;

if (verf->oa_flavor == AUTH_SHORT) {
Expand All @@ -253,13 +255,13 @@ authunix_validate(auth, verf)

static bool_t
authunix_refresh(auth)
register AUTH *auth;
AUTH *auth;
{
register struct audata *au = AUTH_PRIVATE(auth);
struct audata *au = AUTH_PRIVATE(auth);
struct authunix_parms aup;
struct timeval now;
XDR xdrs;
register int stat;
int stat;

if (auth->ah_cred.oa_base == au->au_origcred.oa_base) {
/* there is no hope. Punt */
Expand Down Expand Up @@ -296,9 +298,9 @@ authunix_refresh(auth)

static void
authunix_destroy(auth)
register AUTH *auth;
AUTH *auth;
{
register struct audata *au = AUTH_PRIVATE(auth);
struct audata *au = AUTH_PRIVATE(auth);

mem_free(au->au_origcred.oa_base, au->au_origcred.oa_length);

Expand All @@ -319,18 +321,17 @@ authunix_destroy(auth)
*/
static void
marshal_new_auth(auth)
register AUTH *auth;
AUTH *auth;
{
XDR xdr_stream;
register XDR *xdrs = &xdr_stream;
register struct audata *au = AUTH_PRIVATE(auth);
XDR xdr_stream;
XDR *xdrs = &xdr_stream;
struct audata *au = AUTH_PRIVATE(auth);

xdrmem_create(xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE);
if ((! xdr_opaque_auth(xdrs, &(auth->ah_cred))) ||
(! xdr_opaque_auth(xdrs, &(auth->ah_verf)))) {
perror("auth_none.c - Fatal marshalling problem");
} else {
(! xdr_opaque_auth(xdrs, &(auth->ah_verf))))
warnx("auth_none.c - Fatal marshalling problem");
else
au->au_mpos = XDR_GETPOS(xdrs);
}
XDR_DESTROY(xdrs);
}
9 changes: 5 additions & 4 deletions lib/libc/rpc/authunix_prot.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: authunix_prot.c,v 1.6 1998/02/12 01:57:28 lukem Exp $ */
/* $NetBSD: authunix_prot.c,v 1.7 1998/02/13 05:52:14 lukem Exp $ */

/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
Expand Down Expand Up @@ -35,7 +35,7 @@
static char *sccsid = "@(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)authunix_prot.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: authunix_prot.c,v 1.6 1998/02/12 01:57:28 lukem Exp $");
__RCSID("$NetBSD: authunix_prot.c,v 1.7 1998/02/13 05:52:14 lukem Exp $");
#endif
#endif

Expand All @@ -47,6 +47,7 @@ __RCSID("$NetBSD: authunix_prot.c,v 1.6 1998/02/12 01:57:28 lukem Exp $");
*/

#include "namespace.h"

#include <rpc/types.h>
#include <rpc/xdr.h>
#include <rpc/auth.h>
Expand All @@ -61,8 +62,8 @@ __weak_alias(xdr_authunix_parms,_xdr_authunix_parms);
*/
bool_t
xdr_authunix_parms(xdrs, p)
register XDR *xdrs;
register struct authunix_parms *p;
XDR *xdrs;
struct authunix_parms *p;
{

if (xdr_u_long(xdrs, &(p->aup_time))
Expand Down
14 changes: 9 additions & 5 deletions lib/libc/rpc/bindresvport.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: bindresvport.c,v 1.11 1998/02/12 01:57:29 lukem Exp $ */
/* $NetBSD: bindresvport.c,v 1.12 1998/02/13 05:52:14 lukem Exp $ */

/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
Expand Down Expand Up @@ -35,7 +35,7 @@
static char *sccsid = "@(#)bindresvport.c 1.8 88/02/08 SMI";
static char *sccsid = "@(#)bindresvport.c 2.2 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: bindresvport.c,v 1.11 1998/02/12 01:57:29 lukem Exp $");
__RCSID("$NetBSD: bindresvport.c,v 1.12 1998/02/13 05:52:14 lukem Exp $");
#endif
#endif

Expand All @@ -44,12 +44,16 @@ __RCSID("$NetBSD: bindresvport.c,v 1.11 1998/02/12 01:57:29 lukem Exp $");
*/

#include "namespace.h"
#include <string.h>
#include <unistd.h>

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/socket.h>

#include <netinet/in.h>

#include <errno.h>
#include <string.h>
#include <unistd.h>

#include <rpc/rpc.h>

#ifdef __weak_alias
Expand Down
16 changes: 10 additions & 6 deletions lib/libc/rpc/clnt_generic.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: clnt_generic.c,v 1.10 1998/02/12 01:57:30 lukem Exp $ */
/* $NetBSD: clnt_generic.c,v 1.11 1998/02/13 05:52:15 lukem Exp $ */

/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
Expand Down Expand Up @@ -35,19 +35,23 @@
static char *sccsid = "@(#)clnt_generic.c 1.4 87/08/11 (C) 1987 SMI";
static char *sccsid = "@(#)clnt_generic.c 2.2 88/08/01 4.0 RPCSRC";
#else
__RCSID("$NetBSD: clnt_generic.c,v 1.10 1998/02/12 01:57:30 lukem Exp $");
__RCSID("$NetBSD: clnt_generic.c,v 1.11 1998/02/13 05:52:15 lukem Exp $");
#endif
#endif

/*
* Copyright (C) 1987, Sun Microsystems, Inc.
*/
#include "namespace.h"
#include <string.h>
#include <rpc/rpc.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/errno.h>

#include <errno.h>
#include <netdb.h>
#include <string.h>

#include <rpc/rpc.h>

#ifdef __weak_alias
__weak_alias(clnt_create,_clnt_create);
Expand Down Expand Up @@ -89,7 +93,7 @@ clnt_create(hostname, prog, vers, proto)
sin.sin_len = sizeof(struct sockaddr_in);
sin.sin_family = h->h_addrtype;
sin.sin_port = 0;
bcopy(h->h_addr, (char*)&sin.sin_addr, h->h_length);
memmove((char*)&sin.sin_addr, h->h_addr, h->h_length);
p = getprotobyname(proto);
if (p == NULL) {
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
Expand Down
12 changes: 7 additions & 5 deletions lib/libc/rpc/clnt_perror.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: clnt_perror.c,v 1.13 1998/02/12 01:57:31 lukem Exp $ */
/* $NetBSD: clnt_perror.c,v 1.14 1998/02/13 05:52:16 lukem Exp $ */

/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
Expand Down Expand Up @@ -35,7 +35,7 @@
static char *sccsid = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)clnt_perror.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: clnt_perror.c,v 1.13 1998/02/12 01:57:31 lukem Exp $");
__RCSID("$NetBSD: clnt_perror.c,v 1.14 1998/02/13 05:52:16 lukem Exp $");
#endif
#endif

Expand All @@ -46,9 +46,11 @@ __RCSID("$NetBSD: clnt_perror.c,v 1.13 1998/02/12 01:57:31 lukem Exp $");
*
*/
#include "namespace.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <rpc/rpc.h>
#include <rpc/types.h>
#include <rpc/auth.h>
Expand Down Expand Up @@ -178,7 +180,7 @@ clnt_perror(rpch, s)
CLIENT *rpch;
char *s;
{
(void) fprintf(stderr,"%s\n",clnt_sperror(rpch,s));
(void) fprintf(stderr, "%s\n", clnt_sperror(rpch,s));
}

static const char *const rpc_errlist[] = {
Expand Down Expand Up @@ -222,7 +224,7 @@ void
clnt_perrno(num)
enum clnt_stat num;
{
(void) fprintf(stderr,"%s\n",clnt_sperrno(num));
(void) fprintf(stderr, "%s\n", clnt_sperrno(num));
}


Expand Down Expand Up @@ -276,7 +278,7 @@ void
clnt_pcreateerror(s)
char *s;
{
(void) fprintf(stderr,"%s\n",clnt_spcreateerror(s));
(void) fprintf(stderr, "%s\n", clnt_spcreateerror(s));
}

static const char *const auth_errlist[] = {
Expand Down
Loading

0 comments on commit f0a6859

Please sign in to comment.