diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2017-05-15 12:06:22 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2017-05-15 12:06:22 +0000 |
commit | f6eee9d5d93f3520a710256fe44de129a12f155f (patch) | |
tree | 24028384f5d5adb5b807ad39a82e4a546a2be0ca | |
parent | b29bd3a941d640162496a2ab849fd84ca5dd6cf5 (diff) | |
parent | 49bf4c2bcfc59b4113c3b5ac2986baee668a1319 (diff) | |
download | illumos-joyent-f6eee9d5d93f3520a710256fe44de129a12f155f.tar.gz |
[illumos-gate merge]
commit 49bf4c2bcfc59b4113c3b5ac2986baee668a1319
8219 mech_krb5: misleading-indentation
commit 10243bb069053a813aa803c1bbd2620ef4f0deab
8200 cmd/lp: misleading-indentation
commit a4abf23064b836d7281fdcefd5770736a850349b
8216 libsldap: misleading-indentation
commit 3c1654f0c02621e31840022964bef650dc2e3b53
8207 localedef links against libraries outside of proto area
commit 41e1be47764ad3e5c5c950b7e2c46a7c4f7ecfd4
8218 libshare: misleading-indentation
commit 1307500afcf172c9769fe6fe42f9a5790c1dbe2c
8217 libldap5: misleading-indentation
commit 504dd8f6e2938c3287c29bef6c7b5b3c942e80d1
8214 pam_modules: misleading-indentation
commit 7153155797a2d348ef707cf0655ea4f87b029013
8220 common/iscsi: misleading-indentation
commit cfa354e4631308e491ed50bfe99d3cf93cc69bd9
8180 Invalid netbuf decoded by xdr_netbuf()
-rw-r--r-- | usr/src/cmd/localedef/Makefile | 3 | ||||
-rw-r--r-- | usr/src/cmd/lp/cmd/lpadmin/do_printer.c | 531 | ||||
-rw-r--r-- | usr/src/cmd/lp/model/netpr/netpr.c | 118 | ||||
-rw-r--r-- | usr/src/common/iscsi/utils.c | 2 | ||||
-rw-r--r-- | usr/src/lib/gss_mechs/mech_krb5/krb5/krb/sendauth.c | 17 | ||||
-rw-r--r-- | usr/src/lib/gss_mechs/mech_krb5/krb5/os/sendto_kdc.c | 2 | ||||
-rw-r--r-- | usr/src/lib/libldap5/sources/ldap/common/sort.c | 8 | ||||
-rw-r--r-- | usr/src/lib/libnsl/rpc/rpcb_prot.c | 45 | ||||
-rw-r--r-- | usr/src/lib/libshare/common/libsharecore.c | 2 | ||||
-rw-r--r-- | usr/src/lib/libsldap/common/ns_config.c | 39 | ||||
-rw-r--r-- | usr/src/lib/pam_modules/dhkeys/dhkeys.c | 2 | ||||
-rw-r--r-- | usr/src/uts/common/avs/ns/rdc/rdc_prot.x | 1 | ||||
-rw-r--r-- | usr/src/uts/common/avs/ns/rdc/rdc_svc.c | 22 | ||||
-rw-r--r-- | usr/src/uts/common/rpc/rpcb_prot.c | 69 |
14 files changed, 425 insertions, 436 deletions
diff --git a/usr/src/cmd/localedef/Makefile b/usr/src/cmd/localedef/Makefile index 43e583ed77..358f63de01 100644 --- a/usr/src/cmd/localedef/Makefile +++ b/usr/src/cmd/localedef/Makefile @@ -14,13 +14,14 @@ # Copyright 2011 EveryCity Ltd. All rights reserved. # Copyright 2013 DEY Storage Systems, Inc. # Copyright 2016 Joyent, Inc. +# Copyright 2017 RackTop Systems. # include $(SRC)/cmd/Makefile.cmd include $(SRC)/cmd/Makefile.ctf include $(SRC)/cmd/localedef/Makefile.common -LDLIBS= -lavl -lgen +LDLIBS += -lavl -lgen .KEEP_STATE: diff --git a/usr/src/cmd/lp/cmd/lpadmin/do_printer.c b/usr/src/cmd/lp/cmd/lpadmin/do_printer.c index c1807965f7..c26c59e39a 100644 --- a/usr/src/cmd/lp/cmd/lpadmin/do_printer.c +++ b/usr/src/cmd/lp/cmd/lpadmin/do_printer.c @@ -28,8 +28,6 @@ * Copyright (c) 2016 by Delphix. All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <string.h> #include <errno.h> @@ -49,18 +47,18 @@ #include "msgs.h" #define WHO_AM_I I_AM_LPADMIN -#include "oam.h" +#include "oam.h" #include "lpadmin.h" extern void fromallclasses(); -#if !defined(PATH_MAX) -# define PATH_MAX 1024 +#if !defined(PATH_MAX) +#define PATH_MAX 1024 #endif -#if PATH_MAX < 1024 -# undef PATH_MAX -# define PATH_MAX 1024 +#if PATH_MAX < 1024 +#undef PATH_MAX +#define PATH_MAX 1024 #endif extern char *label; @@ -70,38 +68,40 @@ static char *fullpath(); char *nameit(); static void pack_white(char *ptr); -/** - ** do_printer() - CREATE OR CHANGE PRINTER - **/ +/* + * do_printer() - CREATE OR CHANGE PRINTER + */ -void do_printer () +void +do_printer(void) { - int rc; + int rc; /* * Set or change the printer configuration. */ if (strlen(modifications)) - configure_printer (modifications); + configure_printer(modifications); /* * Allow/deny forms. */ BEGIN_CRITICAL if (!oldp) - if (allow_form_printer(getlist(NAME_NONE, "", ","), p) == -1) { - LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR); + if (allow_form_printer( + getlist(NAME_NONE, "", ","), p) == -1) { + LP_ERRMSG1(ERROR, E_ADM_ACCESSINFO, PERROR); done(1); } if (f_allow || f_deny) { if (f_allow && allow_form_printer(f_allow, p) == -1) { - LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR); + LP_ERRMSG1(ERROR, E_ADM_ACCESSINFO, PERROR); done(1); } if (f_deny && deny_form_printer(f_deny, p) == -1) { - LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR); + LP_ERRMSG1(ERROR, E_ADM_ACCESSINFO, PERROR); done(1); } } @@ -111,21 +111,22 @@ void do_printer () BEGIN_CRITICAL if (!oldp) - if (add_paper_to_printer(getlist(NAME_NONE, "", ","),p) == -1) { - LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR); + if (add_paper_to_printer( + getlist(NAME_NONE, "", ","), p) == -1) { + LP_ERRMSG1(ERROR, E_ADM_ACCESSINFO, PERROR); done(1); } - if (p_add && add_paper_to_printer(p_add, p) == -1) { - LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR); - done(1); - } + if (p_add && add_paper_to_printer(p_add, p) == -1) { + LP_ERRMSG1(ERROR, E_ADM_ACCESSINFO, PERROR); + done(1); + } - if (p_remove && remove_paper_from_printer(p_remove, p) == -1) { - LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR); - done(1); - } + if (p_remove && remove_paper_from_printer(p_remove, p) == -1) { + LP_ERRMSG1(ERROR, E_ADM_ACCESSINFO, PERROR); + done(1); + } END_CRITICAL /* @@ -133,19 +134,20 @@ void do_printer () */ BEGIN_CRITICAL if (!oldp) - if (allow_user_printer(getlist(NAME_ALL, "", ","), p) == -1) { - LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR); + if (allow_user_printer( + getlist(NAME_ALL, "", ","), p) == -1) { + LP_ERRMSG1(ERROR, E_ADM_ACCESSINFO, PERROR); done(1); } if (u_allow || u_deny) { if (u_allow && allow_user_printer(u_allow, p) == -1) { - LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR); + LP_ERRMSG1(ERROR, E_ADM_ACCESSINFO, PERROR); done(1); } if (u_deny && deny_user_printer(u_deny, p) == -1) { - LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR); + LP_ERRMSG1(ERROR, E_ADM_ACCESSINFO, PERROR); done(1); } } @@ -163,18 +165,18 @@ void do_printer () case MNODEST: case MERRDEST: - LP_ERRMSG (ERROR, E_ADM_ERRDEST); - done (1); + LP_ERRMSG(ERROR, E_ADM_ERRDEST); + done(1); /*NOTREACHED*/ case MNOSPACE: - LP_ERRMSG (WARNING, E_ADM_NOPSPACE); + LP_ERRMSG(WARNING, E_ADM_NOPSPACE); break; case MNOPERM: /* taken care of up front */ default: - LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc); - done (1); + LP_ERRMSG1(ERROR, E_LP_BADSTATUS, rc); + done(1); /*NOTREACHED*/ } @@ -187,8 +189,9 @@ void do_printer () * Mount or unmount form, print-wheel. */ if (M) - do_mount(p, (f? f : (char *)0), (S? *S : (char *)0)); - else if (t) do_max_trays(p); + do_mount(p, (f? f : NULL), (S? *S : NULL)); + else if (t) + do_max_trays(p); /* * Display the alert type. @@ -196,7 +199,7 @@ void do_printer () if (A && STREQU(A, NAME_LIST)) { if (label) (void) printf(gettext("Printer %s: "), label); - printalert (stdout, &(oldp->fault_alert), 1); + printalert(stdout, &(oldp->fault_alert), 1); } /* @@ -207,19 +210,19 @@ void do_printer () send_message(S_QUIET_ALERT, p, (char *)QA_PRINTER, ""); rc = output(R_QUIET_ALERT); - switch(rc) { + switch (rc) { case MOK: break; case MNODEST: /* not quite, but not a lie either */ case MERRDEST: - LP_ERRMSG1 (WARNING, E_LP_NOQUIET, p); + LP_ERRMSG1(WARNING, E_LP_NOQUIET, p); break; case MNOPERM: /* taken care of up front */ default: - LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc); - done (1); + LP_ERRMSG1(ERROR, E_LP_BADSTATUS, rc); + done(1); /*NOTREACHED*/ } } @@ -228,8 +231,8 @@ void do_printer () * Add printer p to class c */ if (c) { - CLASS *pc, - clsbuf; + CLASS *pc; + CLASS clsbuf; if (STREQU(c, NAME_ANY)) c = NAME_ALL; @@ -239,13 +242,8 @@ Loop: if (!(pc = getclass(c))) { goto Done; if (errno != ENOENT) { - LP_ERRMSG2 ( - ERROR, - E_LP_GETCLASS, - c, - PERROR - ); - done (1); + LP_ERRMSG2(ERROR, E_LP_GETCLASS, c, PERROR); + done(1); } /* @@ -254,52 +252,48 @@ Loop: if (!(pc = getclass(c))) { clsbuf.name = strdup(c); clsbuf.members = 0; if (addlist(&clsbuf.members, p) == -1) { - LP_ERRMSG (ERROR, E_LP_MALLOC); - done (1); + LP_ERRMSG(ERROR, E_LP_MALLOC); + done(1); } pc = &clsbuf; } else if (searchlist(p, pc->members)) - LP_ERRMSG2 (WARNING, E_ADM_INCLASS, p, pc->name); + LP_ERRMSG2(WARNING, E_ADM_INCLASS, p, pc->name); else if (addlist(&pc->members, p) == -1) { - LP_ERRMSG (ERROR, E_LP_MALLOC); - done (1); + LP_ERRMSG(ERROR, E_LP_MALLOC); + done(1); } BEGIN_CRITICAL if (putclass(pc->name, pc) == -1) { - LP_ERRMSG2 ( - ERROR, - E_LP_PUTCLASS, - pc->name, - PERROR - ); + LP_ERRMSG2(ERROR, E_LP_PUTCLASS, pc->name, + PERROR); done(1); } END_CRITICAL - send_message (S_LOAD_CLASS, pc->name); + send_message(S_LOAD_CLASS, pc->name); rc = output(R_LOAD_CLASS); - switch(rc) { + switch (rc) { case MOK: break; case MNODEST: case MERRDEST: - LP_ERRMSG (ERROR, E_ADM_ERRDEST); - done (1); + LP_ERRMSG(ERROR, E_ADM_ERRDEST); + done(1); /*NOTREACHED*/ case MNOSPACE: - LP_ERRMSG (WARNING, E_ADM_NOCSPACE); + LP_ERRMSG(WARNING, E_ADM_NOCSPACE); break; case MNOPERM: /* taken care of up front */ default: - LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc); - done (1); + LP_ERRMSG1(ERROR, E_LP_BADSTATUS, rc); + done(1); /*NOTREACHED*/ } @@ -316,24 +310,19 @@ Done: else fromclass(p, r); } - - return; } -/** - ** configure_printer() - SET OR CHANGE CONFIGURATION OF PRINTER - **/ +/* + * configure_printer() - SET OR CHANGE CONFIGURATION OF PRINTER + */ -static void configure_printer (list) - char *list; +static void +configure_printer(char *list) { - register PRINTER *prbufp; - - PRINTER printer_struct; - - char type; - char * infile_opts = NULL; - + PRINTER *prbufp; + PRINTER printer_struct; + char type; + char *infile_opts = NULL; if (oldp) { @@ -388,7 +377,7 @@ static void configure_printer (list) */ } else if (oldp->remote) { prbufp->banner = BAN_ALWAYS; - prbufp->interface = makepath(Lp_Model, STANDARD, (char *)0); + prbufp->interface = makepath(Lp_Model, STANDARD, NULL); prbufp->fault_alert.shcmd = nameit(NAME_MAIL); /* @@ -409,14 +398,14 @@ static void configure_printer (list) * or substructure members) needs to be considered * for EACH NEW MEMBER added to the structure. */ - (void)memset (&printer_struct, 0, sizeof(printer_struct)); + (void) memset(&printer_struct, 0, sizeof (printer_struct)); prbufp = &printer_struct; prbufp->banner = BAN_ALWAYS; prbufp->cpi.val = 0; prbufp->cpi.sc = 0; if (!s) - prbufp->interface = makepath(Lp_Model, m, (char *)0); + prbufp->interface = makepath(Lp_Model, m, NULL); prbufp->lpi.val = 0; prbufp->lpi.sc = 0; prbufp->plen.val = 0; @@ -430,211 +419,194 @@ static void configure_printer (list) prbufp->options = NULL; } - while ((type = *list++) != '\0') switch(type) { - - case 'A': - if (!s) { - if (STREQU(A, NAME_MAIL) || STREQU(A, NAME_WRITE)) - prbufp->fault_alert.shcmd = nameit(A); - else if (!STREQU(A, NAME_QUIET)) - prbufp->fault_alert.shcmd = A; - } - break; + while ((type = *list++) != '\0') { + switch (type) { + case 'A': + if (!s) { + if (STREQU(A, NAME_MAIL) || + STREQU(A, NAME_WRITE)) + prbufp->fault_alert.shcmd = nameit(A); + else if (!STREQU(A, NAME_QUIET)) + prbufp->fault_alert.shcmd = A; + } + break; - case 'b': - if (!s) - prbufp->banner = banner; - break; + case 'b': + if (!s) + prbufp->banner = banner; + break; - case 'c': - if (!s) - prbufp->cpi = cpi_sdn; - break; + case 'c': + if (!s) + prbufp->cpi = cpi_sdn; + break; - case 'D': - prbufp->description = D; - break; + case 'D': + prbufp->description = D; + break; - case 'e': - if (!s) { - prbufp->interface = makepath( - Lp_A_Interfaces, - e, - (char *)0 - ); - } - break; + case 'e': + if (!s) { + prbufp->interface = makepath(Lp_A_Interfaces, + e, NULL); + } + break; - case 'F': - if (!s) - prbufp->fault_rec = F; - break; + case 'F': + if (!s) + prbufp->fault_rec = F; + break; #if defined(CAN_DO_MODULES) - case 'H': - if (!s) - prbufp->modules = H; - break; + case 'H': + if (!s) + prbufp->modules = H; + break; #endif - case 'h': - if (!s) - prbufp->login = 0; - break; + case 'h': + if (!s) + prbufp->login = 0; + break; - case 'i': - if (!s) - prbufp->interface = fullpath(i); - break; + case 'i': + if (!s) + prbufp->interface = fullpath(i); + break; - case 'I': - prbufp->input_types = I; - break; + case 'I': + prbufp->input_types = I; + break; - case 'l': - if (!s) - prbufp->login = 1; - break; + case 'l': + if (!s) + prbufp->login = 1; + break; - case 'L': - if (!s) - prbufp->plen = length_sdn; - break; + case 'L': + if (!s) + prbufp->plen = length_sdn; + break; - case 'm': - if (!s) - prbufp->interface = makepath(Lp_Model, m, (char *)0); - break; + case 'm': + if (!s) + prbufp->interface = makepath(Lp_Model, m, NULL); + break; - case 'M': - if (!s) - prbufp->lpi = lpi_sdn; - break; + case 'M': + if (!s) + prbufp->lpi = lpi_sdn; + break; #ifdef LP_USE_PAPI_ATTR - case 'n': - { - if (n_opt != NULL) - { - if (*n_opt == '/') - { - prbufp->ppd = fullpath(n_opt); - } - else - { - prbufp->ppd = - makepath(Lp_Model, "ppd", n_opt, (char *)0); + case 'n': + if (n_opt != NULL) { + if (*n_opt == '/') { + prbufp->ppd = fullpath(n_opt); + } else { + prbufp->ppd = makepath(Lp_Model, "ppd", + n_opt, NULL); + } + ppdopt = 1; } - ppdopt = 1; - } - break; - } + break; #endif - case 'o': - /* - * The "undefined" key-value -o options - * - * Options requires special handling. It is a - * list whose members are to be handled - * individually. - * - * Need to: set new options, keep old options if not - * redefined, remove old options if defined as "key=". - * - * - * "p" is a global containing the printer name - */ - - if (!s) { + case 'o': + /* + * The "undefined" key-value -o options + * + * Options requires special handling. It is a + * list whose members are to be handled + * individually. + * + * Need to: set new options, keep old options if not + * redefined, remove old options if defined as "key=". + * + * + * "p" is a global containing the printer name + */ - if ((infile_opts = getpentry(p, PR_OPTIONS)) == NULL) - prbufp->options = o_options; - else { - prbufp->options = - pick_opts(infile_opts, o_options); + if (!s) { + if ((infile_opts = + getpentry(p, PR_OPTIONS)) == NULL) { + prbufp->options = o_options; + } else { + prbufp->options = pick_opts(infile_opts, + o_options); + } } - } - break; + break; - case 'R': - if (s) { - prbufp->remote = s; - prbufp->dial_info = 0; - prbufp->device = 0; - } else - prbufp->remote = 0; - break; + case 'R': + if (s) { + prbufp->remote = s; + prbufp->dial_info = 0; + prbufp->device = 0; + } else { + prbufp->remote = 0; + } + break; - case 's': - if (!s) { - /* - * lpadmin always defers to stty - */ - prbufp->speed = 0; - prbufp->stty = stty_opt; - } - break; + case 's': + if (!s) { + /* + * lpadmin always defers to stty + */ + prbufp->speed = 0; + prbufp->stty = stty_opt; + } + break; - case 'S': - if (!M) - if (STREQU(*S, NAME_NONE)) - prbufp->char_sets = 0; - else - prbufp->char_sets = S; - break; + case 'S': + if (!M) + if (STREQU(*S, NAME_NONE)) + prbufp->char_sets = 0; + else + prbufp->char_sets = S; + break; - case 'T': - prbufp->printer_types = T; - break; + case 'T': + prbufp->printer_types = T; + break; - case 'U': - if (!s) { - prbufp->dial_info = U; - prbufp->device = 0; - prbufp->remote = 0; - } - break; + case 'U': + if (!s) { + prbufp->dial_info = U; + prbufp->device = 0; + prbufp->remote = 0; + } + break; - case 'v': - if (!s) { - prbufp->device = v; - prbufp->dial_info = 0; - prbufp->remote = 0; - } - break; + case 'v': + if (!s) { + prbufp->device = v; + prbufp->dial_info = 0; + prbufp->remote = 0; + } + break; - case 'w': - if (!s) - prbufp->pwid = width_sdn; - break; + case 'w': + if (!s) + prbufp->pwid = width_sdn; + break; - case 'W': - if (!s) - prbufp->fault_alert.W = W; - break; + case 'W': + if (!s) + prbufp->fault_alert.W = W; + break; + } } BEGIN_CRITICAL if (putprinter(p, prbufp) == -1) { - if ( - errno == EINVAL - && (badprinter & BAD_INTERFACE) - ) - LP_ERRMSG1 ( - ERROR, - E_ADM_BADINTF, - prbufp->interface - ); + if (errno == EINVAL && (badprinter & BAD_INTERFACE)) + LP_ERRMSG1(ERROR, E_ADM_BADINTF, + prbufp->interface); else - LP_ERRMSG2 ( - ERROR, - E_LP_PUTPRINTER, - p, - PERROR - ); + LP_ERRMSG2(ERROR, E_LP_PUTPRINTER, p, PERROR); done(1); } @@ -643,20 +615,17 @@ static void configure_printer (list) update_dev_dbs(p, prbufp->device, "ADD"); END_CRITICAL - - return; } -/** - ** fullpath() - **/ +/* + * fullpath() + */ -static char *fullpath (str) - char *str; +static char * +fullpath(char *str) { - register char *cur_dir, - *path; - + char *cur_dir; + char *path; while (*str && *str == ' ') str++; @@ -666,7 +635,7 @@ static char *fullpath (str) if (!(cur_dir = malloc(PATH_MAX + 1))) return (str); - getcwd (cur_dir, PATH_MAX); + getcwd(cur_dir, PATH_MAX); path = makepath(cur_dir, str, (char *)0); /* @@ -677,22 +646,22 @@ static char *fullpath (str) return (path); } -/** - ** nameit() - ADD USER NAME TO COMMAND - **/ +/* + * nameit() - ADD USER NAME TO COMMAND + */ -char *nameit (cmd) - char *cmd; +char * +nameit(char *cmd) { - register char *nm = getname(), - *copy = malloc( - (unsigned) (strlen(cmd) + 1 + - strlen(nm) + 1) - ); - - (void) strcpy (copy, cmd); - (void) strcat (copy, " "); - (void) strcat (copy, nm); + char *nm; + char *copy; + + nm = getname(); + copy = malloc(strlen(cmd) + 1 + strlen(nm) + 1); + + (void) strcpy(copy, cmd); + (void) strcat(copy, " "); + (void) strcat(copy, nm); return (copy); } diff --git a/usr/src/cmd/lp/model/netpr/netpr.c b/usr/src/cmd/lp/model/netpr/netpr.c index bdce543aa5..9516781fad 100644 --- a/usr/src/cmd/lp/model/netpr/netpr.c +++ b/usr/src/cmd/lp/model/netpr/netpr.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <libintl.h> @@ -76,14 +74,14 @@ net_open(char *host, int timeout) void (*old_handler)(); static struct utsname uts; - int s, - lport, - err, - error_num; + int s; + int lport; + int err; + int error_num; unsigned timo = 1; syslog(LOG_DEBUG, "net_open(%s, %d)", (host != NULL ? host : "NULL"), - timeout); + timeout); /* * Get the host address and port number to connect to. */ @@ -93,7 +91,7 @@ net_open(char *host, int timeout) (void) memset((char *)&sin, NULL, sizeof (sin)); if ((hp = getipnodebyname(host, AF_INET6, AI_DEFAULT, - &error_num)) == NULL) { + &error_num)) == NULL) { syslog(LOG_DEBUG|LOG_ERR, "unknown host %s " "getipnodebyname() returned %d", host, error_num); return (NETWORK_ERROR_HOST); @@ -205,27 +203,23 @@ main(int argc, char *argv[]) case 'I': /* foo-49 */ job_data->request_id = alloc_str((char *)optarg); syslog(LOG_DEBUG, "request_id: %s", - job_data->request_id); + job_data->request_id); break; case 'U': /* awe172-126!wendyp */ job_data->username = alloc_str((char *)optarg); - syslog(LOG_DEBUG, "username: %s", - job_data->username); + syslog(LOG_DEBUG, "username: %s", job_data->username); break; case 'p': /* foo */ job_data->printer = alloc_str((char *)optarg); - syslog(LOG_DEBUG, "printer: %s", - job_data->printer); + syslog(LOG_DEBUG, "printer: %s", job_data->printer); break; case 'd': /* server for printer */ job_data->dest = alloc_str((char *)optarg); - syslog(LOG_DEBUG, "dest: %s", - job_data->dest); + syslog(LOG_DEBUG, "dest: %s", job_data->dest); break; case 'T': /* /tmp/file2 */ job_data->title = alloc_str((char *)optarg); - syslog(LOG_DEBUG, "title: %s", - job_data->title); + syslog(LOG_DEBUG, "title: %s", job_data->title); break; case 'P': if ((strcmp(optarg, "bsd")) == 0) @@ -235,8 +229,7 @@ main(int argc, char *argv[]) else usage_exit(); - syslog(LOG_DEBUG, "protocol: %d", - job_data->protocol); + syslog(LOG_DEBUG, "protocol: %d", job_data->protocol); break; case 't': job_data->timeout = atoi(optarg); @@ -255,8 +248,7 @@ main(int argc, char *argv[]) break; case 'b': job_data->banner = NOBANNER; - syslog(LOG_DEBUG, "banner : %d", - job_data->banner); + syslog(LOG_DEBUG, "banner : %d", job_data->banner); break; case '?': usage_exit(); @@ -264,7 +256,7 @@ main(int argc, char *argv[]) if ((job_data->dest == NULL) || (job_data->request_id == NULL) || - (job_data->printer == NULL) || (job_data->username == NULL)) + (job_data->printer == NULL) || (job_data->username == NULL)) usage_exit(); /* @@ -285,26 +277,30 @@ main(int argc, char *argv[]) if ((filesize = check_file(job_data->filename)) == -1) { syslog(LOG_DEBUG, "Skipping file %s", - job_data->filename ? job_data->filename : "Error NULL file"); + job_data->filename ? + job_data->filename : "Error NULL file"); switch (errno) { case EISDIR: (void) fprintf(stderr, - gettext("Netpr: %s: Not a regular file\n"), - (job_data->filename ? job_data->filename : "Noname")); + gettext("Netpr: %s: Not a regular file\n"), + job_data->filename ? + job_data->filename : "Noname"); syslog(LOG_DEBUG, "Not a regular file"); break; case ESRCH: (void) fprintf(stderr, - gettext("Netpr: %s: Empty file\n"), - (job_data->filename ? job_data->filename : "Noname")); + gettext("Netpr: %s: Empty file\n"), + job_data->filename ? + job_data->filename : "Noname"); syslog(LOG_DEBUG, "Empty file"); break; default: perror(job_data->filename); (void) fprintf(stderr, - gettext("Netpr: Cannot access file %s\n"), - (job_data->filename ? job_data->filename : "Noname")); + gettext("Netpr: Cannot access file %s\n"), + job_data->filename ? + job_data->filename : "Noname"); syslog(LOG_DEBUG, "Cannot access file."); break; @@ -322,21 +318,25 @@ main(int argc, char *argv[]) */ if ((fd = open(job_data->filename, O_RDONLY)) < 0) { (void) fprintf(stderr, gettext("Netpr: Cannot open file %s\n"), - (job_data->filename ? job_data->filename : "Error: NULL file")); + job_data->filename ? + job_data->filename : "Error: NULL file"); syslog(LOG_DEBUG, "Cannot open file: %s", - job_data->filename ? job_data->filename : "Error NULL file"); + job_data->filename ? + job_data->filename : "Error NULL file"); exit(E_BAD_FILE); } if ((pa = mmap((caddr_t)0, filesize, PROT_READ, - (MAP_SHARED | MAP_NORESERVE), fd, (off_t)0)) == MAP_FAILED) { + (MAP_SHARED | MAP_NORESERVE), fd, (off_t)0)) == MAP_FAILED) { (void) close(fd); (void) fprintf(stderr, gettext("Netpr: Cannot mmap file %s"), - (job_data->filename ? job_data->filename : "Error: NULL file")); + job_data->filename ? + job_data->filename : "Error: NULL file"); syslog(LOG_DEBUG, "Cannot mmap file: %s", - job_data->filename ? job_data->filename : "Error NULL file"); + job_data->filename ? + job_data->filename : "Error NULL file"); exit(E_RETRY); } @@ -344,7 +344,7 @@ main(int argc, char *argv[]) if (job_data->protocol == BSD) { bsdjob = (np_bsdjob_t *) - create_bsd_job(job_data, pr_order, filesize); + create_bsd_job(job_data, pr_order, filesize); if (bsdjob == NULL) exit(E_FAILURE); } else { @@ -360,29 +360,27 @@ main(int argc, char *argv[]) if ((strpbrk(job_data->dest, DEST_SEP)) != NULL) { if (job_data->protocol == BSD) { parse_dest(job_data->dest, &destination, - &vendor_pr_name, DEST_SEP); + &vendor_pr_name, DEST_SEP); if (vendor_pr_name != NULL) { bsdjob->np_printer = vendor_pr_name; syslog(LOG_DEBUG, "bsd vendor name: %s", - bsdjob->np_printer); + bsdjob->np_printer); } } else { parse_dest(job_data->dest, &destination, &tcp_port, - DEST_SEP); + DEST_SEP); if (tcp_port != NULL) tcpjob->np_port = tcp_port; - syslog(LOG_DEBUG, "tcp_port %s", - tcpjob->np_port); + syslog(LOG_DEBUG, "tcp_port %s", tcpjob->np_port); } if (destination == NULL || - (job_data->protocol == TCP && tcp_port == NULL)) { - (void) fprintf(stderr, - gettext("Netpr: system error parsing destination %s\n"), - job_data->dest); - syslog(LOG_DEBUG, "system error parsing destination %s", - job_data->dest); - - exit(E_FAILURE); + (job_data->protocol == TCP && tcp_port == NULL)) { + (void) fprintf(stderr, gettext("Netpr: system error " + "parsing destination %s\n"), job_data->dest); + syslog(LOG_DEBUG, "system error parsing destination %s", + job_data->dest); + + exit(E_FAILURE); } } else { @@ -406,9 +404,9 @@ main(int argc, char *argv[]) (void) fprintf(stderr, gettext("Netpr: Cannot open connection to <%s>\n"), destination); - syslog(LOG_DEBUG, - "Cannot open connection to %s: retrying", - destination); + syslog(LOG_DEBUG, + "Cannot open connection to %s: retrying", + destination); exit(E_RETRY); } } else { @@ -426,27 +424,25 @@ main(int argc, char *argv[]) /* Set SO_KEEPALIVE on socket to keep open */ if ((setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, - (char *)&on, sizeof (on))) < 0) { + (char *)&on, sizeof (on))) < 0) { syslog(LOG_DEBUG, "setsocket (SO_KEEPALIVE): %m"); } if (job_data->protocol == BSD) { if ((jobstatus = bsd_print(sockfd, pa, bsdjob)) != 0) { - (void) fprintf(stderr, - gettext("Netpr: Error return from bsd_print <%d>\n"), - jobstatus); + (void) fprintf(stderr, gettext("Netpr: Error return " + "from bsd_print <%d>\n"), jobstatus); syslog(LOG_DEBUG, - "Error return from bsd_print <%d>", jobstatus); + "Error return from bsd_print <%d>", jobstatus); exit_status = E_RETRY; } } else { if ((jobstatus = - tcp_print(sockfd, pa, tcpjob)) != 0) { - (void) fprintf(stderr, - gettext("Netpr: Error return from tcp_print <%d>\n"), - jobstatus); + tcp_print(sockfd, pa, tcpjob)) != 0) { + (void) fprintf(stderr, gettext("Netpr: Error return " + "from tcp_print <%d>\n"), jobstatus); syslog(LOG_DEBUG, - "Error return from tcp_print <%d>", jobstatus); + "Error return from tcp_print <%d>", jobstatus); exit_status = E_RETRY; } } diff --git a/usr/src/common/iscsi/utils.c b/usr/src/common/iscsi/utils.c index e1106be9fc..82fbf96d13 100644 --- a/usr/src/common/iscsi/utils.c +++ b/usr/src/common/iscsi/utils.c @@ -168,7 +168,7 @@ parse_addr_port_tpgt(char *in, char **addr, int *type, char **port, char **tpgt) in = strchr(*addr, ']'); if (in == NULL) return (B_FALSE); - *in++ = '\0'; + *in++ = '\0'; } else { /* IPV4 or domainname */ *type = AF_INET; diff --git a/usr/src/lib/gss_mechs/mech_krb5/krb5/krb/sendauth.c b/usr/src/lib/gss_mechs/mech_krb5/krb5/krb/sendauth.c index ef3324a9d2..433f7191de 100644 --- a/usr/src/lib/gss_mechs/mech_krb5/krb5/krb/sendauth.c +++ b/usr/src/lib/gss_mechs/mech_krb5/krb5/krb/sendauth.c @@ -77,14 +77,15 @@ krb5_sendauth(krb5_context context, krb5_auth_context *auth_context, krb5_pointe * Now, read back a byte: 0 means no error, 1 means bad sendauth * version, 2 means bad application version */ - if ((len = krb5_net_read(context, *((int *) fd), (char *)&result, 1)) != 1) - return((len < 0) ? errno : ECONNABORTED); - if (result == 1) - return(KRB5_SENDAUTH_BADAUTHVERS); - else if (result == 2) - return(KRB5_SENDAUTH_BADAPPLVERS); - else if (result != 0) - return(KRB5_SENDAUTH_BADRESPONSE); + len = krb5_net_read(context, *((int *) fd), (char *)&result, 1); + if (len != 1) + return((len < 0) ? errno : ECONNABORTED); + if (result == 1) + return(KRB5_SENDAUTH_BADAUTHVERS); + else if (result == 2) + return(KRB5_SENDAUTH_BADAPPLVERS); + else if (result != 0) + return(KRB5_SENDAUTH_BADRESPONSE); /* * We're finished with the initial negotiations; let's get and * send over the authentication header. (The AP_REQ message) diff --git a/usr/src/lib/gss_mechs/mech_krb5/krb5/os/sendto_kdc.c b/usr/src/lib/gss_mechs/mech_krb5/krb5/os/sendto_kdc.c index 87d1dce33a..2d36717023 100644 --- a/usr/src/lib/gss_mechs/mech_krb5/krb5/os/sendto_kdc.c +++ b/usr/src/lib/gss_mechs/mech_krb5/krb5/os/sendto_kdc.c @@ -1419,7 +1419,7 @@ krb5int_sendto (krb5_context context, const krb5_data *message, if (localaddr != 0 && localaddrlen != 0 && *localaddrlen > 0) (void) getsockname(conns[winning_conn].fd, localaddr, localaddrlen); - if (remoteaddr != 0 && remoteaddrlen != 0 && *remoteaddrlen > 0) + if (remoteaddr != 0 && remoteaddrlen != 0 && *remoteaddrlen > 0) (void) getpeername(conns[winning_conn].fd, remoteaddr, remoteaddrlen); egress: diff --git a/usr/src/lib/libldap5/sources/ldap/common/sort.c b/usr/src/lib/libldap5/sources/ldap/common/sort.c index 8e02e873cf..b53cae542f 100644 --- a/usr/src/lib/libldap5/sources/ldap/common/sort.c +++ b/usr/src/lib/libldap5/sources/ldap/common/sort.c @@ -1,5 +1,3 @@ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * The contents of this file are subject to the Netscape Public * License Version 1.1 (the "License"); you may not use this file @@ -155,9 +153,9 @@ ldap_sort_strcasecmp( /* XXXceb * I am not 100% sure this is the way this should be handled. * For now we will return a 0 on invalid. - */ - if (NULL == a || NULL == b) - return (0); + */ + if (NULL == a || NULL == b) + return (0); return( strcasecmp( (char *)*a, (char *)*b ) ); } diff --git a/usr/src/lib/libnsl/rpc/rpcb_prot.c b/usr/src/lib/libnsl/rpc/rpcb_prot.c index d81e7e19f8..464ce69743 100644 --- a/usr/src/lib/libnsl/rpc/rpcb_prot.c +++ b/usr/src/lib/libnsl/rpc/rpcb_prot.c @@ -33,8 +33,6 @@ * California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * XDR routines for the rpcbinder version 3. */ @@ -180,7 +178,7 @@ xdr_rpcb_entry_list_ptr(XDR *xdrs, rpcb_entry_list_ptr *rp) next = (*rp)->rpcb_entry_next; if (!xdr_reference(xdrs, (caddr_t *)rp, (uint_t)sizeof (rpcb_entry_list), - (xdrproc_t)xdr_rpcb_entry)) + (xdrproc_t)xdr_rpcb_entry)) return (FALSE); if (freeing) { next_copy = next; @@ -256,8 +254,43 @@ xdr_rpcb_rmtcallres(XDR *xdrs, struct r_rpcb_rmtcallres *objp) bool_t xdr_netbuf(XDR *xdrs, struct netbuf *objp) { - if (!xdr_u_int(xdrs, (uint_t *)&objp->maxlen)) + bool_t res; + + /* + * Save the passed in maxlen value and buf pointer. We might + * need them later. + */ + uint_t maxlen_save = objp->maxlen; + void *buf_save = objp->buf; + + if (!xdr_u_int(xdrs, &objp->maxlen)) return (FALSE); - return (xdr_bytes(xdrs, (char **)&(objp->buf), - (uint_t *)&(objp->len), objp->maxlen)); + + /* + * We need to free maxlen, not len, so do it explicitly now. + */ + if (xdrs->x_op == XDR_FREE) + return (xdr_bytes(xdrs, &objp->buf, &objp->maxlen, + objp->maxlen)); + + /* + * If we're decoding and the caller has already allocated a + * buffer restore the maxlen value since the decoded value + * doesn't apply to the caller's buffer. xdr_bytes() will + * return an error if the buffer isn't big enough. + */ + if (xdrs->x_op == XDR_DECODE && objp->buf != NULL) + objp->maxlen = maxlen_save; + + res = xdr_bytes(xdrs, &objp->buf, &objp->len, objp->maxlen); + + /* + * If we are decoding and the buffer was allocated in the + * xdr_bytes() function we need to set maxlen properly to + * follow the netbuf semantics. + */ + if (xdrs->x_op == XDR_DECODE && objp->buf != buf_save) + objp->maxlen = objp->len; + + return (res); } diff --git a/usr/src/lib/libshare/common/libsharecore.c b/usr/src/lib/libshare/common/libsharecore.c index b8bd1156b1..042bb00726 100644 --- a/usr/src/lib/libshare/common/libsharecore.c +++ b/usr/src/lib/libshare/common/libsharecore.c @@ -436,7 +436,7 @@ adddfsentry(xfs_sharelist_t *list, sa_share_t share, char *proto) } else { for (tmp = list; tmp->next != NULL; tmp = tmp->next) /* do nothing */; - tmp->next = item; + tmp->next = item; } } return (list); diff --git a/usr/src/lib/libsldap/common/ns_config.c b/usr/src/lib/libsldap/common/ns_config.c index 6163e4f266..b4b5b700b5 100644 --- a/usr/src/lib/libsldap/common/ns_config.c +++ b/usr/src/lib/libsldap/common/ns_config.c @@ -71,22 +71,22 @@ extern thread_key_t ns_cmgkey; */ static int __s_val_postime(ParamIndexType i, ns_default_config *def, - ns_param_t *param, char *errbuf); + ns_param_t *param, char *errbuf); static int __s_val_basedn(ParamIndexType i, ns_default_config *def, - ns_param_t *param, char *errbuf); + ns_param_t *param, char *errbuf); static int __s_val_binddn(ParamIndexType i, ns_default_config *def, - ns_param_t *param, char *errbuf); + ns_param_t *param, char *errbuf); static int __s_val_bindpw(ParamIndexType i, ns_default_config *def, - ns_param_t *param, char *errbuf); + ns_param_t *param, char *errbuf); static int __s_val_serverList(ParamIndexType i, ns_default_config *def, - ns_param_t *param, char *errbuf); + ns_param_t *param, char *errbuf); /* * Forward declarations @@ -97,7 +97,7 @@ verify_value(ns_config_t *cfg, char *name, char *value, char *errstr); static int set_default_value(ns_config_t *configptr, char *name, char *value, - ns_ldap_error_t **error); + ns_ldap_error_t **error); static void set_curr_config(ns_config_t *ptr); @@ -835,9 +835,8 @@ destroy_config(ns_config_t *ptr) if (ptr != NULL) { if (ptr == current_config) current_config = NULL; - if (ptr->domainName != NULL) - free(ptr->domainName); - ptr->domainName = NULL; + free(ptr->domainName); + ptr->domainName = NULL; for (i = 0; i <= LAST_VALUE; i++) { destroy_param(ptr, i); } @@ -1371,7 +1370,7 @@ get_defconfig(ns_config_t *ptr, ParamIndexType type) static int set_default_value(ns_config_t *configptr, char *name, - char *value, ns_ldap_error_t **error) + char *value, ns_ldap_error_t **error) { ParamIndexType i; int ret; @@ -1631,7 +1630,7 @@ __s_api_split_key_value(char *buffer, char **name, char **value) */ int __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type, - const void *data, ns_ldap_error_t **error) + const void *data, ns_ldap_error_t **error) { ns_default_config *def = NULL; ns_param_t conf; @@ -2698,7 +2697,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type, int __ns_ldap_setParam(const ParamIndexType type, - const void *data, ns_ldap_error_t **error) + const void *data, ns_ldap_error_t **error) { ns_ldap_error_t *errorp; int ret; @@ -2918,7 +2917,7 @@ __ns_ldap_freeParam(void ***data) int __ns_ldap_getParam(const ParamIndexType Param, - void ***data, ns_ldap_error_t **error) + void ***data, ns_ldap_error_t **error) { char errstr[2 * MAXERROR]; ns_ldap_error_t *errorp; @@ -3273,7 +3272,7 @@ strValueError: /* shared by __door_getldapconfig() and __door_getadmincred() */ int __door_getconf(char **buffer, int *buflen, ns_ldap_error_t **error, - int callnumber) + int callnumber) { typedef union { ldap_data_t s_d; @@ -3359,7 +3358,7 @@ __door_getldapconfig(char **buffer, int *buflen, ns_ldap_error_t **error) */ int SetDoorInfoToUnixCred(char *buffer, ns_ldap_error_t **errorp, - UnixCred_t **cred) + UnixCred_t **cred) { UnixCred_t *ptr; char errstr[MAXERROR]; @@ -3695,7 +3694,7 @@ __s_api_AuthEnumtoStruct(const EnumAuthType_t i) /* ARGSUSED */ static int __s_val_postime(ParamIndexType i, ns_default_config *def, - ns_param_t *param, char *errbuf) + ns_param_t *param, char *errbuf) { char *cp; long tot; @@ -3735,7 +3734,7 @@ __s_val_postime(ParamIndexType i, ns_default_config *def, /* ARGSUSED */ static int __s_val_basedn(ParamIndexType i, ns_default_config *def, - ns_param_t *param, char *errbuf) + ns_param_t *param, char *errbuf) { if (param && param->ns_ptype == CHARPTR && i == NS_LDAP_SEARCH_BASEDN_P && @@ -3758,7 +3757,7 @@ __s_val_basedn(ParamIndexType i, ns_default_config *def, /* ARGSUSED */ static int __s_val_serverList(ParamIndexType i, ns_default_config *def, - ns_param_t *param, char *errbuf) + ns_param_t *param, char *errbuf) { for (i = 0; i < param->ns_acnt; i++) { if ((__s_api_isipv4(param->ns_ppc[i])) || @@ -3783,7 +3782,7 @@ __s_val_serverList(ParamIndexType i, ns_default_config *def, /* ARGSUSED */ static int __s_val_binddn(ParamIndexType i, ns_default_config *def, - ns_param_t *param, char *errbuf) + ns_param_t *param, char *errbuf) { char *dntype; @@ -3810,7 +3809,7 @@ __s_val_binddn(ParamIndexType i, ns_default_config *def, /* ARGSUSED */ static int __s_val_bindpw(ParamIndexType i, ns_default_config *def, - ns_param_t *param, char *errbuf) + ns_param_t *param, char *errbuf) { char *pwtype; diff --git a/usr/src/lib/pam_modules/dhkeys/dhkeys.c b/usr/src/lib/pam_modules/dhkeys/dhkeys.c index b592587b54..b37e422296 100644 --- a/usr/src/lib/pam_modules/dhkeys/dhkeys.c +++ b/usr/src/lib/pam_modules/dhkeys/dhkeys.c @@ -249,7 +249,7 @@ establish_key(pam_handle_t *pamh, int flags, int debug, char *netname) if (err != 1) { if (debug) syslog(LOG_DEBUG, "pam_dhkeys: user2netname failed"); - result = PAM_SYSTEM_ERR; + result = PAM_SYSTEM_ERR; goto out; } diff --git a/usr/src/uts/common/avs/ns/rdc/rdc_prot.x b/usr/src/uts/common/avs/ns/rdc/rdc_prot.x index 3bd8bc877b..cf9055c186 100644 --- a/usr/src/uts/common/avs/ns/rdc/rdc_prot.x +++ b/usr/src/uts/common/avs/ns/rdc/rdc_prot.x @@ -40,7 +40,6 @@ % * <tiuser.h>. Instead we merely declare the XDR routine xdr_netbuf() here, % * and implement it ourselves in rpc/rpcb_prot.c. % */ -%#define xdr_netbuf rdc_xdr_netbuf %#ifdef __cplusplus %extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *); % diff --git a/usr/src/uts/common/avs/ns/rdc/rdc_svc.c b/usr/src/uts/common/avs/ns/rdc/rdc_svc.c index 109cad8bb2..ea1425055d 100644 --- a/usr/src/uts/common/avs/ns/rdc/rdc_svc.c +++ b/usr/src/uts/common/avs/ns/rdc/rdc_svc.c @@ -3077,25 +3077,3 @@ static rdcsrv_t rdc_srvtab[] = { { rdc_disptab6, sizeof (rdc_disptab6) / sizeof (*rdc_disptab6) }, { rdc_disptab7, sizeof (rdc_disptab7) / sizeof (*rdc_disptab7) } }; - -bool_t -rdc_xdr_netbuf(XDR *xdrs, struct netbuf *objp) -{ - /* - * If we're decoding and the caller has already allocated a buffer, - * throw away maxlen, since it doesn't apply to the caller's - * buffer. xdr_bytes will return an error if the buffer isn't big - * enough. - */ - if (xdrs->x_op == XDR_DECODE && objp->buf != NULL) { - uint_t maxlen; - - if (!xdr_u_int(xdrs, &maxlen)) - return (FALSE); - } else { - if (!xdr_u_int(xdrs, (uint_t *)&objp->maxlen)) - return (FALSE); - } - return (xdr_bytes(xdrs, (char **)&(objp->buf), - (uint_t *)&(objp->len), objp->maxlen)); -} diff --git a/usr/src/uts/common/rpc/rpcb_prot.c b/usr/src/uts/common/rpc/rpcb_prot.c index fcc1e5458f..90a711c193 100644 --- a/usr/src/uts/common/rpc/rpcb_prot.c +++ b/usr/src/uts/common/rpc/rpcb_prot.c @@ -37,13 +37,6 @@ * XDR routines for the rpcbinder version 3. */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)rpcb_prot.c 1.9 89/04/21 Copyr 1984 Sun Micro"; -#endif - - #include <rpc/rpc.h> #include <rpc/types.h> #include <rpc/xdr.h> @@ -73,7 +66,7 @@ xdr_rpcb(XDR *xdrs, RPCB *objp) bool_t xdr_rpcb_rmtcallargs(XDR *xdrs, struct rpcb_rmtcallargs *objp) { - u_int lenposition, argposition, position; + uint_t lenposition, argposition, position; if (!xdr_rpcprog(xdrs, &objp->prog)) return (FALSE); @@ -86,15 +79,15 @@ xdr_rpcb_rmtcallargs(XDR *xdrs, struct rpcb_rmtcallargs *objp) */ lenposition = XDR_GETPOS(xdrs); if (!xdr_u_int(xdrs, &(objp->arglen))) - return (FALSE); + return (FALSE); argposition = XDR_GETPOS(xdrs); if (!(*(objp->xdr_args))(xdrs, objp->args_ptr)) - return (FALSE); + return (FALSE); position = XDR_GETPOS(xdrs); - objp->arglen = (u_int)position - (u_int)argposition; + objp->arglen = position - argposition; XDR_SETPOS(xdrs, lenposition); if (!xdr_u_int(xdrs, &(objp->arglen))) - return (FALSE); + return (FALSE); XDR_SETPOS(xdrs, position); return (TRUE); } @@ -116,21 +109,43 @@ xdr_rpcb_rmtcallres(XDR *xdrs, struct rpcb_rmtcallres *objp) bool_t xdr_netbuf(XDR *xdrs, struct netbuf *objp) { + bool_t res; + + /* + * Save the passed in maxlen value and buf pointer. We might + * need them later. + */ + uint_t maxlen_save = objp->maxlen; + void *buf_save = objp->buf; + + if (!xdr_u_int(xdrs, &objp->maxlen)) + return (FALSE); + + /* + * We need to free maxlen, not len, so do it explicitly now. + */ + if (xdrs->x_op == XDR_FREE) + return (xdr_bytes(xdrs, &objp->buf, &objp->maxlen, + objp->maxlen)); + /* - * If we're decoding and the caller has already allocated a buffer, - * throw away maxlen, since it doesn't apply to the caller's - * buffer. xdr_bytes will return an error if the buffer isn't big - * enough. + * If we're decoding and the caller has already allocated a + * buffer restore the maxlen value since the decoded value + * doesn't apply to the caller's buffer. xdr_bytes() will + * return an error if the buffer isn't big enough. */ - if (xdrs->x_op == XDR_DECODE && objp->buf != NULL) { - u_int maxlen; - - if (!xdr_u_int(xdrs, &maxlen)) - return (FALSE); - } else { - if (!xdr_u_int(xdrs, (u_int *)&objp->maxlen)) - return (FALSE); - } - return (xdr_bytes(xdrs, (char **)&(objp->buf), - (u_int *)&(objp->len), objp->maxlen)); + if (xdrs->x_op == XDR_DECODE && objp->buf != NULL) + objp->maxlen = maxlen_save; + + res = xdr_bytes(xdrs, &objp->buf, &objp->len, objp->maxlen); + + /* + * If we are decoding and the buffer was allocated in the + * xdr_bytes() function we need to set maxlen properly to + * follow the netbuf semantics. + */ + if (xdrs->x_op == XDR_DECODE && objp->buf != buf_save) + objp->maxlen = objp->len; + + return (res); } |