summaryrefslogtreecommitdiffstats
path: root/cpukit/librpc/src/rpc
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2005-01-08 06:01:35 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2005-01-08 06:01:35 +0000
commitdab2d6ebae0b1f7d7b72ccafe42b729081409ff2 (patch)
tree4d55fef27d00236c0ca8f9510c161c54fb8f3eff /cpukit/librpc/src/rpc
parentFix typos. (diff)
downloadrtems-dab2d6ebae0b1f7d7b72ccafe42b729081409ff2.tar.bz2
2005-01-07 Ralf Corsepius <ralf.corsepius@rtems.org>
* librpc/include/rpc/auth_des.h, librpc/include/rpc/xdr.h, librpc/src/rpc/auth_des.c, librpc/src/rpc/auth_unix.c, librpc/src/rpc/rpc_prot.c, librpc/src/xdr/xdr.c: Misc. ansi-fications, misc. updates from FreeBSD.
Diffstat (limited to 'cpukit/librpc/src/rpc')
-rw-r--r--cpukit/librpc/src/rpc/auth_des.c47
-rw-r--r--cpukit/librpc/src/rpc/auth_unix.c48
-rw-r--r--cpukit/librpc/src/rpc/rpc_prot.c72
3 files changed, 88 insertions, 79 deletions
diff --git a/cpukit/librpc/src/rpc/auth_des.c b/cpukit/librpc/src/rpc/auth_des.c
index 87d55b67e7..bb64b835b8 100644
--- a/cpukit/librpc/src/rpc/auth_des.c
+++ b/cpukit/librpc/src/rpc/auth_des.c
@@ -51,13 +51,7 @@
static const char rcsid[] = "$FreeBSD: src/lib/libc/rpc/auth_des.c,v 1.3 1999/08/28 00:00:32 peter Exp $";
#endif
-extern bool_t __rpc_get_time_offset __P(( struct timeval *, nis_server *,
- char *, char **, struct sockaddr_in * ));
-extern int rtime __P(( struct sockaddr_in *, struct timeval *, struct timeval *));
-extern bool_t xdr_authdes_cred __P(( XDR *, struct authdes_cred * ));
-extern bool_t xdr_authdes_verf __P(( XDR *, struct authdes_verf * ));
-
-#define MILLION 1000000L
+#define USEC_PER_SEC 1000000L
#define RTIME_TIMEOUT 5 /* seconds to wait for sync */
#define AUTH_PRIVATE(auth) (struct ad_private *) auth->ah_private
@@ -65,16 +59,22 @@ extern bool_t xdr_authdes_verf __P(( XDR *, struct authdes_verf * ));
#define FREE(ptr, size) mem_free((char *)(ptr), (int) size)
#define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE)
+extern int rtime( struct sockaddr_in *, struct timeval *, struct timeval *);
+extern bool_t xdr_authdes_cred(XDR *, struct authdes_cred *);
+extern bool_t xdr_authdes_verf(XDR *, struct authdes_verf *);
+
+extern bool_t __rpc_get_time_offset( struct timeval *, nis_server *, char *,
+ char **, struct sockaddr_in * );
#define debug(msg) /*printf("%s\n", msg) */
/*
* DES authenticator operations vector
*/
-static void authdes_nextverf();
-static bool_t authdes_marshal();
-static bool_t authdes_validate();
-static bool_t authdes_refresh();
-static void authdes_destroy();
+static void authdes_nextverf(AUTH *);
+static bool_t authdes_marshal(AUTH *, XDR *);
+static bool_t authdes_validate(AUTH *, struct opaque_auth *);
+static bool_t authdes_refresh(AUTH *);
+static void authdes_destroy(AUTH *);
static struct auth_ops authdes_ops = {
authdes_nextverf,
authdes_marshal,
@@ -313,8 +313,7 @@ failed:
*/
/*ARGSUSED*/
static void
-authdes_nextverf(auth)
- AUTH *auth;
+authdes_nextverf(AUTH *auth)
{
/* what the heck am I supposed to do??? */
}
@@ -325,9 +324,7 @@ authdes_nextverf(auth)
* 2. Marshal
*/
static bool_t
-authdes_marshal(auth, xdrs)
- AUTH *auth;
- XDR *xdrs;
+authdes_marshal(AUTH *auth, XDR *xdrs)
{
struct ad_private *ad = AUTH_PRIVATE(auth);
struct authdes_cred *cred = &ad->ad_cred;
@@ -345,8 +342,8 @@ authdes_marshal(auth, xdrs)
(void) gettimeofday(&ad->ad_timestamp, (struct timezone *)NULL);
ad->ad_timestamp.tv_sec += ad->ad_timediff.tv_sec;
ad->ad_timestamp.tv_usec += ad->ad_timediff.tv_usec;
- if (ad->ad_timestamp.tv_usec >= MILLION) {
- ad->ad_timestamp.tv_usec -= MILLION;
+ if (ad->ad_timestamp.tv_usec >= USEC_PER_SEC) {
+ ad->ad_timestamp.tv_usec -= USEC_PER_SEC;
ad->ad_timestamp.tv_sec += 1;
}
@@ -416,9 +413,7 @@ authdes_marshal(auth, xdrs)
* 3. Validate
*/
static bool_t
-authdes_validate(auth, rverf)
- AUTH *auth;
- struct opaque_auth *rverf;
+authdes_validate(AUTH *auth, struct opaque_auth *rverf)
{
struct ad_private *ad = AUTH_PRIVATE(auth);
struct authdes_verf verf;
@@ -472,8 +467,7 @@ authdes_validate(auth, rverf)
* 4. Refresh
*/
static bool_t
-authdes_refresh(auth)
- AUTH *auth;
+authdes_refresh(AUTH *auth)
{
struct ad_private *ad = AUTH_PRIVATE(auth);
struct authdes_cred *cred = &ad->ad_cred;
@@ -512,8 +506,7 @@ authdes_refresh(auth)
* 5. Destroy
*/
static void
-authdes_destroy(auth)
- AUTH *auth;
+authdes_destroy(AUTH *auth)
{
struct ad_private *ad = AUTH_PRIVATE(auth);
@@ -546,7 +539,7 @@ synchronize(syncaddr, timep)
timep->tv_sec -= mytime.tv_sec;
if (mytime.tv_usec > timep->tv_usec) {
timep->tv_sec -= 1;
- timep->tv_usec += MILLION;
+ timep->tv_usec += USEC_PER_SEC;
}
timep->tv_usec -= mytime.tv_usec;
return (TRUE);
diff --git a/cpukit/librpc/src/rpc/auth_unix.c b/cpukit/librpc/src/rpc/auth_unix.c
index 885c92a206..279822942a 100644
--- a/cpukit/librpc/src/rpc/auth_unix.c
+++ b/cpukit/librpc/src/rpc/auth_unix.c
@@ -59,11 +59,11 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/auth_unix.c,v 1.12 1999/12/29 0
/*
* Unix authenticator operations vector
*/
-static void authunix_nextverf();
-static bool_t authunix_marshal();
-static bool_t authunix_validate();
-static bool_t authunix_refresh();
-static void authunix_destroy();
+static void authunix_nextverf(AUTH*);
+static bool_t authunix_marshal(AUTH*, XDR*);
+static bool_t authunix_validate(AUTH*, struct opaque_auth *);
+static bool_t authunix_refresh(AUTH*);
+static void authunix_destroy(AUTH*);
static struct auth_ops auth_unix_ops = {
authunix_nextverf,
@@ -109,7 +109,7 @@ 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;
@@ -218,33 +218,28 @@ authunix_create_default()
*/
static void
-authunix_nextverf(auth)
- AUTH *auth;
+authunix_nextverf(AUTH *auth)
{
/* no action necessary */
}
static bool_t
-authunix_marshal(auth, xdrs)
- AUTH *auth;
- XDR *xdrs;
+authunix_marshal(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;
- struct opaque_auth verf;
+authunix_validate( AUTH *auth, struct opaque_auth *verf )
{
register struct audata *au;
XDR xdrs;
- if (verf.oa_flavor == AUTH_SHORT) {
+ if (verf->oa_flavor == AUTH_SHORT) {
au = AUTH_PRIVATE(auth);
- xdrmem_create(&xdrs, verf.oa_base, verf.oa_length, XDR_DECODE);
+ xdrmem_create(&xdrs, verf->oa_base, verf->oa_length, XDR_DECODE);
if (au->au_shcred.oa_base != NULL) {
mem_free(au->au_shcred.oa_base,
@@ -265,14 +260,13 @@ authunix_validate(auth, verf)
}
static bool_t
-authunix_refresh(auth)
- register AUTH *auth;
+authunix_refresh(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 */
@@ -308,10 +302,9 @@ done:
}
static void
-authunix_destroy(auth)
- register AUTH *auth;
+authunix_destroy(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);
@@ -331,12 +324,11 @@ authunix_destroy(auth)
* sets private data, au_marshed and au_mpos
*/
static void
-marshal_new_auth(auth)
- register AUTH *auth;
+marshal_new_auth(AUTH *auth)
{
XDR xdr_stream;
- register XDR *xdrs = &xdr_stream;
- register struct audata *au = AUTH_PRIVATE(auth);
+ 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))) ||
diff --git a/cpukit/librpc/src/rpc/rpc_prot.c b/cpukit/librpc/src/rpc/rpc_prot.c
index 14a2524c70..11a1ad2dcd 100644
--- a/cpukit/librpc/src/rpc/rpc_prot.c
+++ b/cpukit/librpc/src/rpc/rpc_prot.c
@@ -50,9 +50,12 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/rpc_prot.c,v 1.8 1999/08/28 00:
#include <rpc/rpc.h>
+static void accepted(enum accept_stat, struct rpc_err *);
+static void rejected(enum reject_stat, struct rpc_err *);
+
/* * * * * * * * * * * * * * XDR Authentication * * * * * * * * * * * */
-struct opaque_auth _null_auth;
+extern struct opaque_auth _null_auth;
/*
* XDR an opaque authentication struct
@@ -60,8 +63,8 @@ struct opaque_auth _null_auth;
*/
bool_t
xdr_opaque_auth(xdrs, ap)
- register XDR *xdrs;
- register struct opaque_auth *ap;
+ XDR *xdrs;
+ struct opaque_auth *ap;
{
if (xdr_enum(xdrs, &(ap->oa_flavor)))
@@ -75,8 +78,8 @@ xdr_opaque_auth(xdrs, ap)
*/
bool_t
xdr_des_block(xdrs, blkp)
- register XDR *xdrs;
- register des_block *blkp;
+ XDR *xdrs;
+ des_block *blkp;
{
return (xdr_opaque(xdrs, (caddr_t)blkp, sizeof(des_block)));
}
@@ -88,8 +91,8 @@ xdr_des_block(xdrs, blkp)
*/
bool_t
xdr_accepted_reply(xdrs, ar)
- register XDR *xdrs;
- register struct accepted_reply *ar;
+ XDR *xdrs;
+ struct accepted_reply *ar;
{
/* personalized union, rather than calling xdr_union */
@@ -106,7 +109,12 @@ xdr_accepted_reply(xdrs, ar)
if (! xdr_u_int32_t(xdrs, &(ar->ar_vers.low)))
return (FALSE);
return (xdr_u_int32_t(xdrs, &(ar->ar_vers.high)));
- default:
+
+ case GARBAGE_ARGS:
+ case SYSTEM_ERR:
+ case PROC_UNAVAIL:
+ case PROG_UNAVAIL:
+/* default: */
break;
}
return (TRUE); /* TRUE => open ended set of problems */
@@ -117,8 +125,8 @@ xdr_accepted_reply(xdrs, ar)
*/
bool_t
xdr_rejected_reply(xdrs, rr)
- register XDR *xdrs;
- register struct rejected_reply *rr;
+ XDR *xdrs;
+ struct rejected_reply *rr;
{
/* personalized union, rather than calling xdr_union */
@@ -137,9 +145,9 @@ xdr_rejected_reply(xdrs, rr)
return (FALSE);
}
-static struct xdr_discrim reply_dscrm[3] = {
- { (int)MSG_ACCEPTED, xdr_accepted_reply },
- { (int)MSG_DENIED, xdr_rejected_reply },
+static const struct xdr_discrim reply_dscrm[3] = {
+ { (int)MSG_ACCEPTED, (xdrproc_t)xdr_accepted_reply },
+ { (int)MSG_DENIED, (xdrproc_t)xdr_rejected_reply },
{ __dontcare__, NULL_xdrproc_t } };
/*
@@ -147,8 +155,8 @@ static struct xdr_discrim reply_dscrm[3] = {
*/
bool_t
xdr_replymsg(xdrs, rmsg)
- register XDR *xdrs;
- register struct rpc_msg *rmsg;
+ XDR *xdrs;
+ struct rpc_msg *rmsg;
{
if (
xdr_u_int32_t(xdrs, &(rmsg->rm_xid)) &&
@@ -167,8 +175,8 @@ xdr_replymsg(xdrs, rmsg)
*/
bool_t
xdr_callhdr(xdrs, cmsg)
- register XDR *xdrs;
- register struct rpc_msg *cmsg;
+ XDR *xdrs;
+ struct rpc_msg *cmsg;
{
cmsg->rm_direction = CALL;
@@ -187,8 +195,8 @@ xdr_callhdr(xdrs, cmsg)
static void
accepted(acpt_stat, error)
- register enum accept_stat acpt_stat;
- register struct rpc_err *error;
+ enum accept_stat acpt_stat;
+ struct rpc_err *error;
{
switch (acpt_stat) {
@@ -225,8 +233,8 @@ accepted(acpt_stat, error)
static void
rejected(rjct_stat, error)
- register enum reject_stat rjct_stat;
- register struct rpc_err *error;
+ enum reject_stat rjct_stat;
+ struct rpc_err *error;
{
switch (rjct_stat) {
@@ -252,8 +260,8 @@ rejected(rjct_stat, error)
*/
void
_seterr_reply(msg, error)
- register struct rpc_msg *msg;
- register struct rpc_err *error;
+ struct rpc_msg *msg;
+ struct rpc_err *error;
{
/* optimized for normal, SUCCESSful case */
@@ -263,7 +271,7 @@ _seterr_reply(msg, error)
if (msg->acpted_rply.ar_stat == SUCCESS) {
error->re_status = RPC_SUCCESS;
return;
- };
+ }
accepted(msg->acpted_rply.ar_stat, error);
break;
@@ -291,6 +299,22 @@ _seterr_reply(msg, error)
error->re_vers.low = msg->acpted_rply.ar_vers.low;
error->re_vers.high = msg->acpted_rply.ar_vers.high;
break;
+
+ case RPC_FAILED:
+ case RPC_SUCCESS:
+ case RPC_PROGNOTREGISTERED:
+ case RPC_PMAPFAILURE:
+ case RPC_UNKNOWNPROTO:
+ case RPC_UNKNOWNHOST:
+ case RPC_SYSTEMERROR:
+ case RPC_CANTDECODEARGS:
+ case RPC_PROCUNAVAIL:
+ case RPC_PROGUNAVAIL:
+ case RPC_TIMEDOUT:
+ case RPC_CANTRECV:
+ case RPC_CANTSEND:
+ case RPC_CANTDECODERES:
+ case RPC_CANTENCODEARGS:
default:
break;
}