summaryrefslogtreecommitdiff
path: root/sunrpc
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-12-01 11:25:26 +0000
committerUlrich Drepper <drepper@redhat.com>1998-12-01 11:25:26 +0000
commitee586e0ec492d818be9aa0c77dd44095d42f486f (patch)
tree21172ee5bbec6a0a0be049d633b6b9e7d9034c90 /sunrpc
parent28ab8526f2cf0dfbe0da8b4a6ef46e5efb8c3e4b (diff)
Update.
1998-12-01 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * sunrpc/auth_des.c: Use new XDR int32 functions for integers. * sunrpc/rpc/xdr.h: Add IXDR INT32 functions. * sunrpc/rpc_hout.c: Remove (u_long) casts in defines to avoid conflicts with new solaris version. * sunrpc/rpc_main.c: Fix bug in generating Makefile name (malloc doesn't zero allocated memory). * sunrpc/rpc_svcout.c: Local variables now starts with a _ to avoid conflicts with xdr functions. Solves PR libc/877. * nis/rpcsvc/nis.x: Use always uint32_t. * nis/rpcsvc/nis.h: Likewise. * nis/rpcsvc/nis_object.x: Likewise. 1998-12-01 Ulrich Drepper <drepper@cygnus.com> * math/libm-test.c: Various cleanups. Patch by Zack Weinberg. * sysdeps/unix/sysv/linux/alpha/setfpucw.c: Use correct type for parameter. Patch by Christian Gafton. * string/envz.h: Add prototype for envz_remove. Reported by Andreas Jaeger.
Diffstat (limited to 'sunrpc')
-rw-r--r--sunrpc/auth_des.c81
-rw-r--r--sunrpc/rpc/xdr.h37
-rw-r--r--sunrpc/rpc_hout.c15
-rw-r--r--sunrpc/rpc_main.c13
-rw-r--r--sunrpc/rpc_svcout.c14
5 files changed, 80 insertions, 80 deletions
diff --git a/sunrpc/auth_des.c b/sunrpc/auth_des.c
index cd68c22ee9..d8659a9b6c 100644
--- a/sunrpc/auth_des.c
+++ b/sunrpc/auth_des.c
@@ -70,8 +70,7 @@ static void authdes_destroy (AUTH *);
static bool_t synchronize (struct sockaddr *, struct timeval *)
internal_function;
-static struct auth_ops authdes_ops =
-{
+static struct auth_ops authdes_ops = {
authdes_nextverf,
authdes_marshal,
authdes_validate,
@@ -83,23 +82,22 @@ static struct auth_ops authdes_ops =
/*
* This struct is pointed to by the ah_private field of an "AUTH *"
*/
-struct ad_private
- {
- char *ad_fullname; /* client's full name */
- u_int ad_fullnamelen; /* length of name, rounded up */
- char *ad_servername; /* server's full name */
- u_int ad_servernamelen; /* length of name, rounded up */
- u_int ad_window; /* client specified window */
- bool_t ad_dosync; /* synchronize? */
- struct sockaddr ad_syncaddr; /* remote host to synch with */
- struct timeval ad_timediff; /* server's time - client's time */
- u_long ad_nickname; /* server's nickname for client */
- struct authdes_cred ad_cred; /* storage for credential */
- struct authdes_verf ad_verf; /* storage for verifier */
- struct timeval ad_timestamp; /* timestamp sent */
- des_block ad_xkey; /* encrypted conversation key */
- u_char ad_pkey[1024]; /* Servers actual public key */
- };
+struct ad_private {
+ char *ad_fullname; /* client's full name */
+ u_int ad_fullnamelen; /* length of name, rounded up */
+ char *ad_servername; /* server's full name */
+ u_int ad_servernamelen; /* length of name, rounded up */
+ uint32_t ad_window; /* client specified window */
+ bool_t ad_dosync; /* synchronize? */
+ struct sockaddr ad_syncaddr; /* remote host to synch with */
+ struct timeval ad_timediff; /* server's time - client's time */
+ u_long ad_nickname; /* server's nickname for client */
+ struct authdes_cred ad_cred; /* storage for credential */
+ struct authdes_verf ad_verf; /* storage for verifier */
+ struct timeval ad_timestamp; /* timestamp sent */
+ des_block ad_xkey; /* encrypted conversation key */
+ u_char ad_pkey[1024]; /* Servers actual public key */
+};
/*
@@ -236,7 +234,7 @@ authdes_marshal (AUTH * auth, XDR * xdrs)
des_block cryptbuf[2];
des_block ivec;
int status;
- int len;
+ unsigned int len;
register long *ixdr;
/*
@@ -255,14 +253,15 @@ authdes_marshal (AUTH * auth, XDR * xdrs)
/*
* XDR the timestamp and possibly some other things, then
* encrypt them.
+ * XXX We have a real Year 2038 problem here.
*/
ixdr = (long *) cryptbuf;
IXDR_PUT_LONG (ixdr, ad->ad_timestamp.tv_sec);
IXDR_PUT_LONG (ixdr, ad->ad_timestamp.tv_usec);
if (ad->ad_cred.adc_namekind == ADN_FULLNAME)
{
- IXDR_PUT_U_LONG (ixdr, ad->ad_window);
- IXDR_PUT_U_LONG (ixdr, ad->ad_window - 1);
+ IXDR_PUT_U_INT32 (ixdr, ad->ad_window);
+ IXDR_PUT_U_INT32 (ixdr, ad->ad_window - 1);
ivec.key.high = ivec.key.low = 0;
status = cbc_crypt ((char *) &auth->ah_key, (char *) cryptbuf,
2 * sizeof (des_block), DES_ENCRYPT | DES_HW, (char *) &ivec);
@@ -304,29 +303,29 @@ authdes_marshal (AUTH * auth, XDR * xdrs)
if ((ixdr = xdr_inline (xdrs, 2 * BYTES_PER_XDR_UNIT)) != NULL)
{
- IXDR_PUT_LONG (ixdr, AUTH_DES);
- IXDR_PUT_LONG (ixdr, len);
+ IXDR_PUT_INT32 (ixdr, AUTH_DES);
+ IXDR_PUT_U_INT32 (ixdr, len);
}
else
{
- ATTEMPT (xdr_putlong (xdrs, (long *)&auth->ah_cred.oa_flavor));
- ATTEMPT (xdr_putlong (xdrs, (long *)&len));
+ ATTEMPT (xdr_putint32 (xdrs, &auth->ah_cred.oa_flavor));
+ ATTEMPT (xdr_putint32 (xdrs, &len));
}
ATTEMPT (xdr_authdes_cred (xdrs, cred));
len = (2 + 1) * BYTES_PER_XDR_UNIT;
if ((ixdr = xdr_inline (xdrs, 2 * BYTES_PER_XDR_UNIT)) != NULL)
{
- IXDR_PUT_LONG (ixdr, AUTH_DES);
- IXDR_PUT_LONG (ixdr, len);
+ IXDR_PUT_INT32 (ixdr, AUTH_DES);
+ IXDR_PUT_U_INT32 (ixdr, len);
}
else
{
- ATTEMPT (xdr_putlong (xdrs, (long *)&auth->ah_verf.oa_flavor));
- ATTEMPT (xdr_putlong (xdrs, (long *)&len));
+ ATTEMPT (xdr_putint32 (xdrs, &auth->ah_verf.oa_flavor));
+ ATTEMPT (xdr_putint32 (xdrs, &len));
}
ATTEMPT (xdr_authdes_verf (xdrs, verf));
- return (TRUE);
+ return TRUE;
}
@@ -334,7 +333,7 @@ authdes_marshal (AUTH * auth, XDR * xdrs)
* 3. Validate
*/
static bool_t
-authdes_validate (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;
@@ -358,7 +357,7 @@ authdes_validate (AUTH * auth, struct opaque_auth *rverf)
if (DES_FAILED (status))
{
debug ("authdes_validate: DES decryption failure");
- return (FALSE);
+ return FALSE;
}
/*
@@ -375,7 +374,7 @@ authdes_validate (AUTH * auth, struct opaque_auth *rverf)
sizeof (struct timeval)) != 0)
{
debug ("authdes_validate: verifier mismatch\n");
- return (FALSE);
+ return FALSE;
}
/*
@@ -383,14 +382,14 @@ authdes_validate (AUTH * auth, struct opaque_auth *rverf)
*/
ad->ad_nickname = verf.adv_nickname;
ad->ad_cred.adc_namekind = ADN_NICKNAME;
- return (TRUE);
+ return TRUE;
}
/*
* 4. Refresh
*/
static bool_t
-authdes_refresh (AUTH * auth)
+authdes_refresh (AUTH *auth)
{
netobj pkey;
struct ad_private *ad = AUTH_PRIVATE (auth);
@@ -411,19 +410,19 @@ authdes_refresh (AUTH * auth)
if (key_encryptsession_pk (ad->ad_servername, &pkey, &ad->ad_xkey) < 0)
{
debug ("authdes_create: unable to encrypt conversation key");
- return (FALSE);
+ return FALSE;
}
cred->adc_fullname.key = ad->ad_xkey;
cred->adc_namekind = ADN_FULLNAME;
cred->adc_fullname.name = ad->ad_fullname;
- return (TRUE);
+ return TRUE;
}
/*
* 5. Destroy
*/
static void
-authdes_destroy (AUTH * auth)
+authdes_destroy (AUTH *auth)
{
struct ad_private *ad = AUTH_PRIVATE (auth);
@@ -447,7 +446,7 @@ synchronize (struct sockaddr *syncaddr, struct timeval *timep)
timeout.tv_sec = RTIME_TIMEOUT;
timeout.tv_usec = 0;
if (rtime ((struct sockaddr_in *) syncaddr, timep, &timeout) < 0)
- return (FALSE);
+ return FALSE;
__gettimeofday (&mytime, (struct timezone *) NULL);
timep->tv_sec -= mytime.tv_sec;
@@ -457,5 +456,5 @@ synchronize (struct sockaddr *syncaddr, struct timeval *timep)
timep->tv_usec += MILLION;
}
timep->tv_usec -= mytime.tv_usec;
- return (TRUE);
+ return TRUE;
}
diff --git a/sunrpc/rpc/xdr.h b/sunrpc/rpc/xdr.h
index dd9959aa5e..cd28717221 100644
--- a/sunrpc/rpc/xdr.h
+++ b/sunrpc/rpc/xdr.h
@@ -154,6 +154,7 @@ struct XDR
*/
typedef bool_t (*xdrproc_t) __PMT ((XDR *, void *,...));
+
/*
* Operations defined on a XDR handle
*
@@ -247,20 +248,28 @@ struct xdr_discrim
* N.B. and frozen for all time: each data type here uses 4 bytes
* of external representation.
*/
-#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*((u_int32_t*)buf)++))
-#define IXDR_PUT_LONG(buf, v) (*((u_int32_t*)(buf))++ = (long)htonl((u_long)v))
-
-#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
-#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf))
-#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf))
-#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf))
-#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf))
-
-#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
+
+#define IXDR_GET_INT32(buf) ((int32_t)ntohl((uint32_t)*(buf)++))
+#define IXDR_PUT_INT32(buf, v) (*(buf)++ = (int32_t)htonl((uint32_t)v))
+#define IXDR_GET_U_INT32(buf) ((uint32_t)IXDR_GET_INT32(buf))
+#define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32((buf), ((int32_t)(v)))
+
+#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_INT32(buf))
+#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_INT32(buf))
+#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_INT32(buf))
+#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_INT32(buf))
+
+#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_INT32((buf), ((int)(v)))
+#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_INT32((buf), ((int)(v)))
+#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_INT32((buf), ((int)(v)))
+#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_INT32((buf), ((int)(v)))
+
+/* This defines are removed from Sun for new platforms and shouldn't
+ be used any longer. */
+#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*((u_int32_t*)buf)++))
+#define IXDR_PUT_LONG(buf, v) (*((u_int32_t*)(buf))++ = (long)htonl((u_long)v))
+#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf))
+#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
/*
* These are the "generic" xdr routines.
diff --git a/sunrpc/rpc_hout.c b/sunrpc/rpc_hout.c
index 4c49d10bbe..a41a7e7c91 100644
--- a/sunrpc/rpc_hout.c
+++ b/sunrpc/rpc_hout.c
@@ -48,7 +48,6 @@ static void pargdef (definition * def);
static void pstructdef (definition * def);
static void puniondef (definition * def);
static void pdefine (const char *name, const char *num);
-static void puldefine (const char *name, const char *num);
static int define_printed (proc_list * stop, version_list * start);
static void pprogramdef (definition * def);
static void parglist (proc_list * proc, const char *addargtype);
@@ -251,12 +250,6 @@ pdefine (const char *name, const char *num)
f_print (fout, "#define %s %s\n", name, num);
}
-static void
-puldefine (const char *name, const char *num)
-{
- f_print (fout, "#define %s ((u_long)%s)\n", name, num);
-}
-
static int
define_printed (proc_list *stop, version_list *start)
{
@@ -302,7 +295,7 @@ pprogramdef (definition *def)
pargdef (def);
- puldefine (def->def_name, def->def.pr.prog_num);
+ pdefine (def->def_name, def->def.pr.prog_num);
for (vers = def->def.pr.versions; vers != NULL; vers = vers->next)
{
if (tblflag)
@@ -312,7 +305,7 @@ pprogramdef (definition *def)
f_print (fout, "extern %s_%s_nproc;\n",
locase (def->def_name), vers->vers_num);
}
- puldefine (vers->vers_name, vers->vers_num);
+ pdefine (vers->vers_name, vers->vers_num);
/*
* Print out 2 definitions, one for ANSI-C, another for
@@ -327,7 +320,7 @@ pprogramdef (definition *def)
{
if (!define_printed(proc, def->def.pr.versions))
{
- puldefine (proc->proc_name, proc->proc_num);
+ pdefine (proc->proc_name, proc->proc_num);
}
f_print (fout, "%s", ext);
pprocdef (proc, vers, NULL, 0, 2);
@@ -359,7 +352,7 @@ pprogramdef (definition *def)
{
if (!define_printed(proc, def->def.pr.versions))
{
- puldefine(proc->proc_name, proc->proc_num);
+ pdefine(proc->proc_name, proc->proc_num);
}
f_print (fout, "%s", ext);
pprocdef (proc, vers, "CLIENT *", 0, i);
diff --git a/sunrpc/rpc_main.c b/sunrpc/rpc_main.c
index 6cdef73d79..8302f810c4 100644
--- a/sunrpc/rpc_main.c
+++ b/sunrpc/rpc_main.c
@@ -968,7 +968,6 @@ mkfile_output (struct commandline *cmd)
char *mkfilename;
const char *clientname, *clntname, *xdrname, *hdrname;
const char *servername, *svcname, *servprogname, *clntprogname;
- char *temp;
svcname = file_name (cmd->infile, "_svc.c");
clntname = file_name (cmd->infile, "_clnt.c");
@@ -990,12 +989,12 @@ mkfile_output (struct commandline *cmd)
if (allfiles)
{
- mkfilename = alloc (strlen ("Makefile.") +
- strlen (cmd->infile) + 1);
- temp = (char *) rindex (cmd->infile, '.');
- strcat (mkfilename, "Makefile.");
- strncat (mkfilename, cmd->infile,
- (temp - cmd->infile));
+ char *cp, *temp;
+
+ mkfilename = alloc (strlen ("Makefile.") + strlen (cmd->infile) + 1);
+ temp = rindex (cmd->infile, '.');
+ cp = stpcpy (mkfilename, "Makefile.");
+ strncpy (cp, cmd->infile, (temp - cmd->infile));
}
else
mkfilename = (char *) cmd->outfile;
diff --git a/sunrpc/rpc_svcout.c b/sunrpc/rpc_svcout.c
index 2869d3d844..aad9412884 100644
--- a/sunrpc/rpc_svcout.c
+++ b/sunrpc/rpc_svcout.c
@@ -72,10 +72,10 @@ static void
p_xdrfunc (const char *rname, const char *typename)
{
if (Cflag)
- f_print (fout, "\t\txdr_%s = (xdrproc_t) xdr_%s;\n", rname,
+ f_print (fout, "\t\t_xdr_%s = (xdrproc_t) xdr_%s;\n", rname,
stringfix (typename));
else
- f_print (fout, "\t\txdr_%s = xdr_%s;\n", rname, stringfix (typename));
+ f_print (fout, "\t\t_xdr_%s = xdr_%s;\n", rname, stringfix (typename));
}
void
@@ -503,7 +503,7 @@ write_program (const definition * def, const char *storage)
if (Cflag)
{
- f_print (fout, "\txdrproc_t xdr_%s, xdr_%s;\n", ARG, RESULT);
+ f_print (fout, "\txdrproc_t _xdr_%s, _xdr_%s;\n", ARG, RESULT);
if (mtflag)
f_print(fout,
"\tbool_t (*%s)(char *, void *, struct svc_req *);\n",
@@ -619,11 +619,11 @@ write_program (const definition * def, const char *storage)
RETVAL, ROUTINE, ARG, RESULT, RQSTP);
if (mtflag)
f_print(fout,
- "\tif (%s > 0 && !svc_sendreply(%s, xdr_%s, (char *)&%s)) {\n",
+ "\tif (%s > 0 && !svc_sendreply(%s, _xdr_%s, (char *)&%s)) {\n",
RETVAL, TRANSP, RESULT, RESULT);
else
f_print(fout,
- "\tif (%s != NULL && !svc_sendreply(%s, xdr_%s, %s)) {\n",
+ "\tif (%s != NULL && !svc_sendreply(%s, _xdr_%s, %s)) {\n",
RESULT, TRANSP, RESULT, RESULT);
printerr ("systemerr", TRANSP);
@@ -643,7 +643,7 @@ write_program (const definition * def, const char *storage)
{
f_print(fout,"\tif (!");
pvname(def->def_name, vp->vers_num);
- f_print(fout,"_freeresult (%s, xdr_%s, (caddr_t) &%s))\n",
+ f_print(fout,"_freeresult (%s, _xdr_%s, (caddr_t) &%s))\n",
TRANSP, RESULT, RESULT);
(void) sprintf(_errbuf, "unable to free results");
print_err_message("\t\t");
@@ -664,7 +664,7 @@ static void
printif (const char *proc, const char *transp, const char *prefix,
const char *arg)
{
- f_print (fout, "\tif (!svc_%s (%s, xdr_%s, %s%s)) {\n",
+ f_print (fout, "\tif (!svc_%s (%s, _xdr_%s, %s%s)) {\n",
proc, transp, arg, prefix, arg);
}