--- old/usr/src/Targetdirs Mon Oct 29 22:52:05 2007 +++ new/usr/src/Targetdirs Mon Oct 29 22:52:05 2007 @@ -1022,6 +1022,8 @@ $(ROOT)/usr/lib/llib-lpthread:= REALPATH=../../lib/llib-lpthread $(ROOT)/usr/lib/llib-lresolv.ln:= REALPATH=../../lib/llib-lresolv.ln $(ROOT)/usr/lib/llib-lresolv:= REALPATH=../../lib/llib-lresolv +$(ROOT)/usr/lib/llib-lrpcsvc.ln:= REALPATH=../../lib/llib-lrpcsvc.ln +$(ROOT)/usr/lib/llib-lrpcsvc:= REALPATH=../../lib/llib-lrpcsvc $(ROOT)/usr/lib/llib-lrt.ln:= REALPATH=../../lib/llib-lrt.ln $(ROOT)/usr/lib/llib-lrt:= REALPATH=../../lib/llib-lrt $(ROOT)/usr/lib/llib-lrtld_db.ln:= REALPATH=../../lib/llib-lrtld_db.ln @@ -1357,6 +1359,8 @@ REALPATH=../../../lib/$(MACH64)/llib-lpthread.ln $(ROOT)/usr/lib/$(MACH64)/llib-lresolv.ln:= \ REALPATH=../../../lib/$(MACH64)/llib-lresolv.ln +$(ROOT)/usr/lib/$(MACH64)/llib-lrpcsvc.ln:= \ + REALPATH=../../../lib/$(MACH64)/llib-lrpcsvc.ln $(ROOT)/usr/lib/$(MACH64)/llib-lrt.ln:= \ REALPATH=../../../lib/$(MACH64)/llib-lrt.ln $(ROOT)/usr/lib/$(MACH64)/llib-lrtld_db.ln:= \ @@ -1602,6 +1606,8 @@ /usr/lib/llib-lpthread.ln \ /usr/lib/llib-lresolv \ /usr/lib/llib-lresolv.ln \ + /usr/lib/llib-lrpcsvc \ + /usr/lib/llib-lrpcsvc.ln \ /usr/lib/llib-lrt \ /usr/lib/llib-lrt.ln \ /usr/lib/llib-lrtld_db \ @@ -1797,6 +1803,7 @@ /usr/lib/$(MACH64)/llib-lposix4.ln \ /usr/lib/$(MACH64)/llib-lpthread.ln \ /usr/lib/$(MACH64)/llib-lresolv.ln \ + /usr/lib/$(MACH64)/llib-lrpcsvc.ln \ /usr/lib/$(MACH64)/llib-lrt.ln \ /usr/lib/$(MACH64)/llib-lrtld_db.ln \ /usr/lib/$(MACH64)/llib-lscf.ln \ --- old/usr/src/cmd/fs.d/nfs/mount/mount.c Mon Oct 29 22:52:06 2007 +++ new/usr/src/cmd/fs.d/nfs/mount/mount.c Mon Oct 29 22:52:06 2007 @@ -125,7 +125,7 @@ { (args)->nfs_args_ext = NFS_ARGS_EXTB, \ (args)->nfs_ext_u.nfs_extB.secdata = secdata; } -extern int __clnt_bindresvport(); +extern int __clnt_bindresvport(CLIENT *); extern char *nfs_get_qop_name(); extern AUTH * nfs_create_ah(); extern enum snego_stat nfs_sec_nego(); @@ -320,13 +320,13 @@ */ read_default(); if (vers_min_default > vers_max_default || - vers_min_default < NFS_VERSMIN || - vers_max_default > NFS_VERSMAX) { + vers_min_default < NFS_VERSMIN || + vers_max_default > NFS_VERSMAX) { pr_err("%s %s\n%s %s\n", - gettext("Incorrect configuration of client\'s"), - NFSADMIN, - gettext("NFS_CLIENT_VERSMIN or NFS_CLIENT_VERSMAX"), - gettext("is either out of range or overlaps.")); + gettext("Incorrect configuration of client\'s"), + NFSADMIN, + gettext("NFS_CLIENT_VERSMIN or NFS_CLIENT_VERSMAX"), + gettext("is either out of range or overlaps.")); } SET_ERR_RET(&retry_error, ERR_PROTO_NONE, 0); @@ -482,7 +482,7 @@ cb = strchr(host, ']'); if (cb == NULL) { pr_err(gettext( - "illegal nfs url syntax\n")); + "illegal nfs url syntax\n")); last_error = RET_ERR; goto out; } else { @@ -491,7 +491,7 @@ cb++; if (*cb == ':') port = htons((ushort_t) - atoi(cb+1)); + atoi(cb+1)); } } else { sport = strchr(host, ':'); @@ -534,7 +534,7 @@ if (replicated && !(mntflags & MS_RDONLY)) { pr_err(gettext( - "replicated mounts must be read-only\n")); + "replicated mounts must be read-only\n")); last_error = RET_ERR; goto out; } @@ -541,7 +541,7 @@ if (replicated && (argp->flags & NFSMNT_SOFT)) { pr_err(gettext( - "replicated mounts must not be soft\n")); + "replicated mounts must not be soft\n")); last_error = RET_ERR; goto out; } @@ -557,7 +557,7 @@ */ if ((use_pubfh == TRUE) || (url == TRUE)) { r = get_fh_via_pub(argp, host, path, url, use_pubfh, - &vers, &nconf, port); + &vers, &nconf, port); if (r != RET_OK) { /* @@ -597,7 +597,7 @@ loud_on_mnt_err = TRUE; r = get_fh(argp, host, path, &vers, - loud_on_mnt_err, &nconf, port); + loud_on_mnt_err, &nconf, port); if (r != RET_OK) { @@ -622,7 +622,7 @@ strcat(newpath, path); r = get_fh(argp, host, newpath, &vers, - TRUE, &nconf, port); + TRUE, &nconf, port); if (r == RET_OK) path = newpath; @@ -669,7 +669,7 @@ host, path); (void) fprintf(stderr, gettext( " contact admin to install server change\n")); - argp->flags |= NFSMNT_LLOCK; + argp->flags |= NFSMNT_LLOCK; } if (self_check(host)) @@ -684,10 +684,10 @@ if (!(argp->flags & NFSMNT_KNCONF)) { nconf = NULL; if (r = getaddr_nfs(argp, host, &nconf, - FALSE, path, port, retry_error, - TRUE)) { - last_error = r; - goto out; + FALSE, path, port, retry_error, + TRUE)) { + last_error = r; + goto out; } } } @@ -761,18 +761,18 @@ saveopts = strdup(mntp->mnt_mntopts); if (mount(mntp->mnt_special, mntp->mnt_mountp, mntflags, fstype, args, - sizeof (*args), mntp->mnt_mntopts, MAX_MNTOPT_STR) < 0) { + sizeof (*args), mntp->mnt_mntopts, MAX_MNTOPT_STR) < 0) { if (errno != ENOENT) { pr_err(gettext("mount: %s: %s\n"), - mntp->mnt_mountp, strerror(errno)); + mntp->mnt_mountp, strerror(errno)); } else { struct stat sb; if (stat(mntp->mnt_mountp, &sb) < 0 && errno == ENOENT) pr_err(gettext("mount: %s: %s\n"), - mntp->mnt_mountp, strerror(ENOENT)); + mntp->mnt_mountp, strerror(ENOENT)); else pr_err("%s: %s\n", mntp->mnt_special, - strerror(ENOENT)); + strerror(ENOENT)); } last_error = RET_ERR; @@ -1027,9 +1027,9 @@ case OPT_SECURE: if (nfs_getseconfig_byname("dh", &nfs_sec)) { - pr_err(gettext("can not get \"dh\" from %s\n"), - NFSSEC_CONF); - goto badopt; + pr_err(gettext("can not get \"dh\" from %s\n"), + NFSSEC_CONF); + goto badopt; } sec_opt++; break; @@ -1070,7 +1070,7 @@ if (bad(val)) goto badopt; args->acdirmin = args->acregmin = args->acdirmax - = args->acregmax = atoi(val); + = args->acregmax = atoi(val); break; case OPT_ACREGMIN: args->flags |= NFSMNT_ACREGMIN; @@ -1143,9 +1143,9 @@ case OPT_SEC: if (nfs_getseconfig_byname(val, &nfs_sec)) { - pr_err(gettext("can not get \"%s\" from %s\n"), - val, NFSSEC_CONF); - return (RET_ERR); + pr_err(gettext("can not get \"%s\" from %s\n"), + val, NFSSEC_CONF); + return (RET_ERR); } sec_opt++; break; @@ -1251,11 +1251,12 @@ * security mode. * */ - if (nfs_getseconfig_default(&nfs_sec)) { - pr_err(gettext("error getting default security entry\n")); - return (-1); - } - args->flags |= NFSMNT_SECDEFAULT; + if (nfs_getseconfig_default(&nfs_sec)) { + pr_err(gettext("error getting default" + " security entry\n")); + return (-1); + } + args->flags |= NFSMNT_SECDEFAULT; } /* @@ -1282,7 +1283,7 @@ */ if (use_pubfh == FALSE && vers != NFS_V4) { syncaddr = get_the_addr(hostname, RPCBPROG, RPCBVERS, - nconf, 0, NULL, NULL, FALSE, NULL, NULL); + nconf, 0, NULL, NULL, FALSE, NULL, NULL); } if (syncaddr != NULL) { @@ -1298,9 +1299,9 @@ error = netdir_getbyname(nconf, &hs, &retaddrs); if (error != ND_OK && (nfs_sec.sc_rpcnum == AUTH_DH)) { - pr_err(gettext("%s: secure: no time service\n"), - hostname); - return (-1); + pr_err(gettext("%s: secure: no time service\n"), + hostname); + return (-1); } if (error == ND_OK) @@ -1312,15 +1313,15 @@ * and netname data. */ if (vers == NFS_V4 && syncaddr && - host2netname(netname, hostname, NULL)) { - args->syncaddr = malloc(sizeof (struct netbuf)); - args->syncaddr->buf = malloc(syncaddr->len); - (void) memcpy(args->syncaddr->buf, syncaddr->buf, - syncaddr->len); - args->syncaddr->len = syncaddr->len; - args->syncaddr->maxlen = syncaddr->maxlen; - args->netname = strdup(netname); - args->flags |= NFSMNT_SECURE; + host2netname(netname, hostname, NULL)) { + args->syncaddr = malloc(sizeof (struct netbuf)); + args->syncaddr->buf = malloc(syncaddr->len); + (void) memcpy(args->syncaddr->buf, + syncaddr->buf, syncaddr->len); + args->syncaddr->len = syncaddr->len; + args->syncaddr->maxlen = syncaddr->maxlen; + args->netname = strdup(netname); + args->flags |= NFSMNT_SECURE; } } } @@ -1332,7 +1333,7 @@ * extended data structure. */ if (!(secdata = nfs_clnt_secdata(&nfs_sec, hostname, args->knconf, - syncaddr, flags))) { + syncaddr, flags))) { pr_err(gettext("errors constructing security related data\n")); if (flags & AUTH_F_RPCTIMESYNC) { free(syncaddr->buf); @@ -1382,11 +1383,11 @@ return (NULL); if ((fd = t_open(nconf->nc_device, O_RDWR, tinfo)) == -1) - goto done; + goto done; /* LINTED pointer alignment */ if ((tbind = (struct t_bind *)t_alloc(fd, T_BIND, T_ADDR)) - == NULL) + == NULL) goto done; /* @@ -1402,7 +1403,7 @@ /* NFS where vers==4 does not support UDP */ if (vers == NFS_V4 && strncasecmp(nconf->nc_proto, NC_UDP, - strlen(NC_UDP)) == 0) { + strlen(NC_UDP)) == 0) { SET_ERR_RET(error, ERR_PROTO_UNSUPP, 0); goto done; } @@ -1425,7 +1426,7 @@ goto done; } memcpy(tbind->addr.buf, retaddrs->n_addrs->buf, - retaddrs->n_addrs->len); + retaddrs->n_addrs->len); tbind->addr.len = retaddrs->n_addrs->len; netdir_free((void *)retaddrs, ND_ADDRLIST); (void) netdir_options(nconf, ND_SET_RESERVEDPORT, fd, NULL); @@ -1441,11 +1442,10 @@ /* LINTED pointer alignment */ if (strcmp(nconf->nc_protofmly, NC_INET) == 0) ((struct sockaddr_in *)tbind->addr.buf)->sin_port - = port; + = port; else if (strcmp(nconf->nc_protofmly, NC_INET6) == 0) ((struct sockaddr_in6 *)tbind->addr.buf)->sin6_port - = port; - + = port; } cl = clnt_tli_create(fd, nconf, &tbind->addr, prog, vers, 0, 0); @@ -1476,139 +1476,147 @@ (void) clnt_control(cl, CLSET_TIMEOUT, (char *)&tv); if ((get_pubfh == TRUE) && (vers != NFS_V4)) { - enum snego_stat sec; + enum snego_stat sec; - if (!snego_done) { - /* - * negotiate sec flavor. - */ - snego.cnt = 0; - if ((sec = nfs_sec_nego(vers, cl, fspath, &snego)) == - SNEGO_SUCCESS) { - int jj; + if (!snego_done) { + /* + * negotiate sec flavor. + */ + snego.cnt = 0; + if ((sec = nfs_sec_nego(vers, cl, + fspath, &snego)) == SNEGO_SUCCESS) { + int jj; - /* - * check if server supports the one - * specified in the sec= option. - */ - if (sec_opt) { - for (jj = 0; jj < snego.cnt; jj++) { - if (snego.array[jj] == nfs_sec.sc_nfsnum) { - snego_done = TRUE; - break; - } - } - } - - /* - * find a common sec flavor - */ - if (!snego_done) { - if (sec_opt) { - pr_err(gettext( - "Server does not support the security" - " flavor specified.\n")); - } - for (jj = 0; jj < snego.cnt; jj++) { - if (!nfs_getseconfig_bynumber(snego.array[jj], - &nfs_sec)) { - snego_done = TRUE; + /* + * check if server supports the one + * specified in the sec= option. + */ if (sec_opt) { - pr_err(gettext( - "Security flavor %d was negotiated and" - " will be used.\n"), - nfs_sec.sc_nfsnum); + for (jj = 0; jj < snego.cnt; jj++) { + if (snego.array[jj] == + nfs_sec.sc_nfsnum) { + snego_done = TRUE; + break; + } + } } - break; - } + + /* + * find a common sec flavor + */ + if (!snego_done) { + if (sec_opt) { + pr_err(gettext( + "Server does not support" + " the security" + " flavor specified.\n")); + } + + for (jj = 0; jj < snego.cnt; jj++) { + if (!nfs_getseconfig_bynumber( + snego.array[jj], + &nfs_sec)) { + snego_done = TRUE; + if (sec_opt) { + pr_err(gettext( + "Security flavor %d was negotiated and will be used.\n"), + nfs_sec. + sc_nfsnum); + } + + break; + } + } + + if (!snego_done) + return (NULL); + } + + /* + * Now that the flavor has been + * negotiated, get the fh. + * + * First, create an auth handle using + * the negotiated sec flavor in the + * next lookup to fetch the filehandle. + */ + new_ah = nfs_create_ah(cl, hostname, &nfs_sec); + if (new_ah == NULL) + goto done; + cl->cl_auth = new_ah; + } else if (sec == SNEGO_ARRAY_TOO_SMALL || sec == + SNEGO_FAILURE) { + goto done; } - } - if (!snego_done) - return (NULL); - /* - * Now that the flavor has been - * negotiated, get the fh. - * - * First, create an auth handle using the negotiated - * sec flavor in the next lookup to - * fetch the filehandle. - */ - new_ah = nfs_create_ah(cl, hostname, &nfs_sec); - if (new_ah == NULL) - goto done; - cl->cl_auth = new_ah; - } else if (sec == SNEGO_ARRAY_TOO_SMALL || sec == - SNEGO_FAILURE) { - goto done; + /* + * Note that if sec == SNEGO_DEF_VALID + * default sec flavor is acceptable. + * Use it to get the filehandle. + */ } - /* - * Note that if sec == SNEGO_DEF_VALID - * default sec flavor is acceptable. - * Use it to get the filehandle. - */ - } - if (vers == NFS_VERSION) { - wnl_diropargs arg; - wnl_diropres *res; + if (vers == NFS_VERSION) { + wnl_diropargs arg; + wnl_diropres *res; - memset((char *)&arg.dir, 0, sizeof (wnl_fh)); - arg.name = fspath; - res = wnlproc_lookup_2(&arg, cl); + memset((char *)&arg.dir, 0, sizeof (wnl_fh)); + arg.name = fspath; + res = wnlproc_lookup_2(&arg, cl); - if (res == NULL || res->status != NFS_OK) - goto done; - *fhp = malloc(sizeof (wnl_fh)); + if (res == NULL || res->status != NFS_OK) + goto done; + *fhp = malloc(sizeof (wnl_fh)); - if (*fhp == NULL) { - pr_err(gettext("no memory\n")); - goto done; - } + if (*fhp == NULL) { + pr_err(gettext("no memory\n")); + goto done; + } - memcpy((char *)*fhp, - (char *)&res->wnl_diropres_u.wnl_diropres.file, - sizeof (wnl_fh)); - } else { - WNL_LOOKUP3args arg; - WNL_LOOKUP3res *res; - nfs_fh3 *fh3p; + memcpy((char *)*fhp, + (char *)&res->wnl_diropres_u.wnl_diropres.file, + sizeof (wnl_fh)); + } else { + WNL_LOOKUP3args arg; + WNL_LOOKUP3res *res; + nfs_fh3 *fh3p; - memset((char *)&arg.what.dir, 0, sizeof (wnl_fh3)); - arg.what.name = fspath; - res = wnlproc3_lookup_3(&arg, cl); + memset((char *)&arg.what.dir, 0, sizeof (wnl_fh3)); + arg.what.name = fspath; + res = wnlproc3_lookup_3(&arg, cl); - if (res == NULL || res->status != NFS3_OK) - goto done; + if (res == NULL || res->status != NFS3_OK) + goto done; - fh3p = (nfs_fh3 *)malloc(sizeof (*fh3p)); + fh3p = (nfs_fh3 *)malloc(sizeof (*fh3p)); - if (fh3p == NULL) { - pr_err(gettext("no memory\n")); - CLNT_FREERES(cl, xdr_WNL_LOOKUP3res, (char *)res); - goto done; - } + if (fh3p == NULL) { + pr_err(gettext("no memory\n")); + CLNT_FREERES(cl, xdr_WNL_LOOKUP3res, + (char *)res); + goto done; + } - fh3p->fh3_length = - res->WNL_LOOKUP3res_u.res_ok.object.data.data_len; - memcpy(fh3p->fh3_u.data, - res->WNL_LOOKUP3res_u.res_ok.object.data.data_val, - fh3p->fh3_length); + fh3p->fh3_length = + res->WNL_LOOKUP3res_u.res_ok.object.data.data_len; + memcpy(fh3p->fh3_u.data, + res->WNL_LOOKUP3res_u.res_ok.object.data.data_val, + fh3p->fh3_length); - *fhp = (caddr_t)fh3p; + *fhp = (caddr_t)fh3p; - CLNT_FREERES(cl, xdr_WNL_LOOKUP3res, (char *)res); - } + CLNT_FREERES(cl, xdr_WNL_LOOKUP3res, (char *)res); + } } else { void *res; struct rpc_err r_err; if (vers == NFS_VERSION) - res = wnlproc_null_2(NULL, cl); + res = wnlproc_null_2(NULL, cl); else if (vers == NFS_V3) - res = wnlproc3_null_3(NULL, cl); + res = wnlproc3_null_3(NULL, cl); else - res = wnlproc4_null_4(NULL, cl); + res = wnlproc4_null_4(NULL, cl); if (res == NULL) { clnt_geterr(cl, &r_err); @@ -1645,14 +1653,14 @@ done: if (cl) { - if (ah != NULL) { - if (new_ah != NULL) - AUTH_DESTROY(ah); - AUTH_DESTROY(cl->cl_auth); - cl->cl_auth = NULL; - } - clnt_destroy(cl); - cl = NULL; + if (ah != NULL) { + if (new_ah != NULL) + AUTH_DESTROY(ah); + AUTH_DESTROY(cl->cl_auth); + cl->cl_auth = NULL; + } + clnt_destroy(cl); + cl = NULL; } if (tbind) { t_free((char *)tbind, T_BIND); @@ -1704,7 +1712,7 @@ if (nconfp && *nconfp) return (get_the_addr(hostname, prog, vers, *nconfp, port, - tinfo, fhp, get_pubfh, fspath, error)); + tinfo, fhp, get_pubfh, fspath, error)); /* * No nconf passed in. * @@ -1739,17 +1747,15 @@ SET_ERR_RET(error, ERR_PROTO_UNSUPP, 0); if ((port != 0) && - ((strcmp(nconf->nc_protofmly, NC_INET) == 0 || - strcmp(nconf->nc_protofmly, NC_INET6) == 0) && - (strcmp(nconf->nc_proto, NC_TCP) != 0 && - strcmp(nconf->nc_proto, NC_UDP) != 0))) - + ((strcmp(nconf->nc_protofmly, NC_INET) == 0 || + strcmp(nconf->nc_protofmly, NC_INET6) == 0) && + (strcmp(nconf->nc_proto, NC_TCP) != 0 && + strcmp(nconf->nc_proto, NC_UDP) != 0))) { continue; - - else { + } else { nb = get_the_addr(hostname, prog, - vers, nconf, port, tinfo, - fhp, get_pubfh, fspath, error); + vers, nconf, port, tinfo, + fhp, get_pubfh, fspath, error); if (nb != NULL) break; @@ -1758,12 +1764,12 @@ if (error) { if (error->error_type == ERR_NOHOST) SET_ERR_RET(&errsave_nohost, - error->error_type, - error->error_value); + error->error_type, + error->error_value); if (error->error_type == ERR_RPCERROR) SET_ERR_RET(&errsave_rpcerr, - error->error_type, - error->error_value); + error->error_type, + error->error_value); } /* * continue with same protocol @@ -1777,10 +1783,8 @@ goto done; if ((nb = get_the_addr(hostname, prog, vers, nconf, port, - tinfo, fhp, get_pubfh, fspath, error)) == NULL) + tinfo, fhp, get_pubfh, fspath, error)) == NULL) goto done; - - } else { retry: SET_ERR_RET(error, ERR_NETPATH, 0); @@ -1789,42 +1793,39 @@ if (nconf->nc_flag & NC_VISIBLE) { if (nthtry == FIRST_TRY) { if ((nconf->nc_semantics == - NC_TPI_COTS_ORD) || + NC_TPI_COTS_ORD) || (nconf->nc_semantics == - NC_TPI_COTS)) { + NC_TPI_COTS)) { if (port == 0) break; if ((strcmp(nconf->nc_protofmly, - NC_INET) == 0 || - strcmp(nconf-> - nc_protofmly, - NC_INET6) == 0) && + NC_INET) == 0 || + strcmp(nconf->nc_protofmly, + NC_INET6) == 0) && (strcmp(nconf->nc_proto, - NC_TCP) == 0)) - + NC_TCP) == 0)) break; } } if (nthtry == SECOND_TRY) { if (nconf->nc_semantics == - NC_TPI_CLTS) { + NC_TPI_CLTS) { if (port == 0) break; if ((strcmp(nconf->nc_protofmly, - NC_INET) == 0 || - strcmp(nconf-> - nc_protofmly, NC_INET6) - == 0) && - (strcmp( - nconf->nc_proto, - NC_UDP) == 0)) + NC_INET) == 0 || + strcmp(nconf->nc_protofmly, + NC_INET6) == 0) && + (strcmp(nconf->nc_proto, + NC_UDP) == 0)) break; } } } } /* while */ + if (nconf == NULL) { if (++nthtry <= MNT_PREF_LISTLEN) { endnetpath(nc); @@ -1835,18 +1836,19 @@ goto done; } else { if ((nb = get_the_addr(hostname, prog, vers, nconf, - port, tinfo, fhp, get_pubfh, fspath, error)) - == NULL) { + port, tinfo, fhp, get_pubfh, fspath, error)) + == NULL) { + /* nb is NULL - deal with errors */ if (error) { if (error->error_type == ERR_NOHOST) SET_ERR_RET(&errsave_nohost, - error->error_type, - error->error_value); + error->error_type, + error->error_value); if (error->error_type == ERR_RPCERROR) SET_ERR_RET(&errsave_rpcerr, - error->error_type, - error->error_value); + error->error_type, + error->error_value); } /* * Continue the same search path in the @@ -1880,11 +1882,11 @@ */ if (errsave_nohost.error_type != ERR_PROTO_NONE) SET_ERR_RET(error, errsave_nohost.error_type, - errsave_nohost.error_value); + errsave_nohost.error_value); if (errsave_rpcerr.error_type != ERR_PROTO_NONE) SET_ERR_RET(error, errsave_rpcerr.error_type, - errsave_rpcerr.error_value); + errsave_rpcerr.error_value); } return (nb); @@ -1932,7 +1934,7 @@ * getaddr_nfs will also fill in the fh for us. */ r = getaddr_nfs(args, fshost, nconfp, - TRUE, path, port, NULL, FALSE); + TRUE, path, port, NULL, FALSE); if (r == RET_OK) { /* @@ -1965,7 +1967,7 @@ if (loud == TRUE) { pr_err(gettext("Could not use public filehandle in request to" - " server %s\n"), fshost); + " server %s\n"), fshost); } return (r); @@ -2041,9 +2043,8 @@ /* Let's hope for the best */ nfsvers_to_use = NFS_V4; - retval = - getaddr_nfs(args, fshost, nconfp, FALSE, - fspath, port, &error, vers_min == NFS_V4); + retval = getaddr_nfs(args, fshost, nconfp, FALSE, + fspath, port, &error, vers_min == NFS_V4); if (retval == RET_OK) { *versp = nfsvers_to_use = NFS_V4; @@ -2076,7 +2077,7 @@ } while ((cl = clnt_create_vers(fshost, MOUNTPROG, &outvers, - vers_min, vers_to_try, "datagram_v")) == NULL) { + vers_min, vers_to_try, "datagram_v")) == NULL) { if (rpc_createerr.cf_stat == RPC_UNKNOWNHOST) { pr_err(gettext("%s: %s\n"), fshost, clnt_spcreateerror("")); @@ -2087,7 +2088,7 @@ * We don't want to downgrade version on lost packets */ if ((rpc_createerr.cf_stat == RPC_TIMEDOUT) || - (rpc_createerr.cf_stat == RPC_PMAPFAILURE)) { + (rpc_createerr.cf_stat == RPC_PMAPFAILURE)) { pr_err(gettext("%s: %s\n"), fshost, clnt_spcreateerror("")); return (RET_RETRY); @@ -2148,7 +2149,7 @@ case MOUNTVERS_POSIX: *versp = nfsvers_to_use = NFS_VERSION; rpc_stat = clnt_call(cl, MOUNTPROC_MNT, xdr_dirpath, - (caddr_t)&fspath, xdr_fhstatus, (caddr_t)&fhs, timeout); + (caddr_t)&fspath, xdr_fhstatus, (caddr_t)&fhs, timeout); if (rpc_stat != RPC_SUCCESS) { pr_err(gettext("%s:%s: server not responding %s\n"), fshost, fspath, clnt_sperror(cl, "")); @@ -2158,13 +2159,14 @@ if ((errno = fhs.fhs_status) != MNT_OK) { if (loud_on_mnt_err) { - if (errno == EACCES) { - pr_err(gettext("%s:%s: access denied\n"), - fshost, fspath); - } else { - pr_err(gettext("%s:%s: %s\n"), fshost, fspath, - strerror(errno)); - } + if (errno == EACCES) { + pr_err(gettext( + "%s:%s: access denied\n"), + fshost, fspath); + } else { + pr_err(gettext("%s:%s: %s\n"), + fshost, fspath, strerror(errno)); + } } clnt_destroy(cl); return (RET_MNTERR); @@ -2175,11 +2177,11 @@ return (RET_ERR); } memcpy((caddr_t)args->fh, (caddr_t)&fhs.fhstatus_u.fhs_fhandle, - sizeof (fhs.fhstatus_u.fhs_fhandle)); + sizeof (fhs.fhstatus_u.fhs_fhandle)); if (!errno && posix) { rpc_stat = clnt_call(cl, MOUNTPROC_PATHCONF, - xdr_dirpath, (caddr_t)&fspath, xdr_ppathcnf, - (caddr_t)&p, timeout); + xdr_dirpath, (caddr_t)&fspath, xdr_ppathcnf, + (caddr_t)&p, timeout); if (rpc_stat != RPC_SUCCESS) { pr_err(gettext( "%s:%s: server not responding %s\n"), @@ -2205,7 +2207,7 @@ return (RET_ERR); } memcpy((caddr_t)args->pathconf, (caddr_t)&p, - sizeof (p)); + sizeof (p)); } break; @@ -2212,8 +2214,8 @@ case MOUNTVERS3: *versp = nfsvers_to_use = NFS_V3; rpc_stat = clnt_call(cl, MOUNTPROC_MNT, xdr_dirpath, - (caddr_t)&fspath, - xdr_mountres3, (caddr_t)&mountres3, timeout); + (caddr_t)&fspath, xdr_mountres3, + (caddr_t)&mountres3, timeout); if (rpc_stat != RPC_SUCCESS) { pr_err(gettext("%s:%s: server not responding %s\n"), fshost, fspath, clnt_sperror(cl, "")); @@ -2226,25 +2228,28 @@ * codes map into E* errors. */ if ((errno = mountres3.fhs_status) != MNT_OK) { - if (loud_on_mnt_err) { - switch (errno) { - case MNT3ERR_NAMETOOLONG: - msg = "path name is too long"; - break; - case MNT3ERR_NOTSUPP: - msg = "operation not supported"; - break; - case MNT3ERR_SERVERFAULT: - msg = "server fault"; - break; - default: - msg = strerror(errno); - break; + if (loud_on_mnt_err) { + switch (errno) { + case MNT3ERR_NAMETOOLONG: + msg = "path name is too long"; + break; + case MNT3ERR_NOTSUPP: + msg = "operation not supported"; + break; + case MNT3ERR_SERVERFAULT: + msg = "server fault"; + break; + default: + msg = strerror(errno); + break; + } + + pr_err(gettext("%s:%s: %s\n"), + fshost, fspath, msg); } - pr_err(gettext("%s:%s: %s\n"), fshost, fspath, msg); - } - clnt_destroy(cl); - return (RET_MNTERR); + + clnt_destroy(cl); + return (RET_MNTERR); } fh3p = (nfs_fh3 *)malloc(sizeof (*fh3p)); @@ -2253,10 +2258,10 @@ return (RET_ERR); } fh3p->fh3_length = - mountres3.mountres3_u.mountinfo.fhandle.fhandle3_len; + mountres3.mountres3_u.mountinfo.fhandle.fhandle3_len; (void) memcpy(fh3p->fh3_u.data, - mountres3.mountres3_u.mountinfo.fhandle.fhandle3_val, - fh3p->fh3_length); + mountres3.mountres3_u.mountinfo.fhandle.fhandle3_val, + fh3p->fh3_length); args->fh = (caddr_t)fh3p; fstype = MNTTYPE_NFS3; @@ -2274,30 +2279,32 @@ * */ auths = - mountres3.mountres3_u.mountinfo.auth_flavors.auth_flavors_val; + mountres3.mountres3_u.mountinfo.auth_flavors. + auth_flavors_val; count = - mountres3.mountres3_u.mountinfo.auth_flavors.auth_flavors_len; + mountres3.mountres3_u.mountinfo.auth_flavors. + auth_flavors_len; if (sec_opt) { for (i = 0; i < count; i++) { if (auths[i] == nfs_sec.sc_nfsnum) - break; + break; } - if (i >= count) { + if (i >= count) goto autherr; - } } else { - if (count > 0) { - for (i = 0; i < count; i++) { - if (!nfs_getseconfig_bynumber(auths[i], &nfs_sec)) { - sec_opt++; - break; - } + if (count > 0) { + for (i = 0; i < count; i++) { + if (!nfs_getseconfig_bynumber(auths[i], + &nfs_sec)) { + sec_opt++; + break; + } + } + + if (i >= count) + goto autherr; } - if (i >= count) { - goto autherr; - } - } } break; default: @@ -2312,8 +2319,8 @@ autherr: pr_err(gettext( - "security mode does not match the server exporting %s:%s\n"), - fshost, fspath); + "security mode does not match the server exporting %s:%s\n"), + fshost, fspath); clnt_destroy(cl); return (RET_ERR); } @@ -2384,23 +2391,23 @@ printed = 1; break; case ERR_RPCERROR: + /* no error print at this time */ if (!print_rpcerror) - /* no error print at this time */ break; pr_err(gettext("%s NFS service not" - " available %s\n"), fshost, + " available %s\n"), fshost, clnt_sperrno(addr_error.error_value)); printed = 1; break; case ERR_NETPATH: pr_err(gettext("%s: Error in NETPATH.\n"), - fshost); + fshost); printed = 1; break; case ERR_PROTO_INVALID: pr_err(gettext("%s: NFS service does not" - " recognize protocol: %s.\n"), fshost, - nfs_proto); + " recognize protocol: %s.\n"), fshost, + nfs_proto); printed = 1; break; case ERR_PROTO_UNSUPP: @@ -2423,8 +2430,8 @@ * and retry below. */ pr_err(gettext("%s: NFS service does" - " not support protocol: %s.\n"), - fshost, nfs_proto); + " not support protocol: %s.\n"), + fshost, nfs_proto); } break; case ERR_NOHOST: @@ -2434,20 +2441,21 @@ default: /* case ERR_PROTO_NONE falls through */ pr_err(gettext("%s: NFS service not responding" - "\n"), fshost); + "\n"), fshost); printed = 1; break; } } + SET_ERR_RET(error, - addr_error.error_type, addr_error.error_value); + addr_error.error_type, addr_error.error_value); if (addr_error.error_type == ERR_PROTO_NONE) return (RET_RETRY); else if (addr_error.error_type == ERR_RPCERROR && - ! IS_UNRECOVERABLE_RPC(addr_error.error_value)) { + ! IS_UNRECOVERABLE_RPC(addr_error.error_value)) { return (RET_RETRY); } else if (nfsvers == 0 && addr_error.error_type == - ERR_PROTO_UNSUPP && nfsvers_to_use != NFS_VERSMIN) { + ERR_PROTO_UNSUPP && nfsvers_to_use != NFS_VERSMIN) { /* * If no version is specified, and the error is due * to an unsupported transport, then decrement the @@ -2520,10 +2528,10 @@ break; if (count > 0) { - (void) sleep(delay); - delay *= 2; - if (delay > 120) - delay = 120; + (void) sleep(delay); + delay *= 2; + if (delay > 120) + delay = 120; } } --- old/usr/src/cmd/fs.d/nfs/umount/umount.c Mon Oct 29 22:52:07 2007 +++ new/usr/src/cmd/fs.d/nfs/umount/umount.c Mon Oct 29 22:52:07 2007 @@ -75,7 +75,7 @@ static int nfs_unmount(char *, int); static void inform_server(char *, char *, bool_t); static struct extmnttab *mnttab_find(); -extern int __clnt_bindresvport(); +extern int __clnt_bindresvport(CLIENT *); static int is_v4_mount(struct extmnttab *); @@ -98,7 +98,7 @@ myname = strrchr(argv[0], '/'); myname = myname ? myname+1 : argv[0]; - (void) sprintf(typename, "nfs %s", myname); + (void) snprintf(typename, sizeof (typename), "nfs %s", myname); argv[0] = typename; /* @@ -154,7 +154,7 @@ usage() { (void) fprintf(stderr, - gettext("Usage: nfs umount [-o opts] {server:path | dir}\n")); + gettext("Usage: nfs umount [-f] {server:path | dir}\n")); exit(RET_ERR); } @@ -226,7 +226,7 @@ } } - fclose(fp); + (void) fclose(fp); return (res); } @@ -251,7 +251,7 @@ if (list == NULL) { if (n < 0) pr_err(gettext("%s is not hostname:path format\n"), - string); + string); else pr_err(gettext("no memory\n")); return; @@ -296,7 +296,7 @@ */ timep = (quick ? &create_timeout : NULL); cl = clnt_create_timed(list[i].host, MOUNTPROG, vers, - "datagram_n", timep); + "datagram_n", timep); /* * Do not print any error messages in case of forced * unmount. @@ -305,7 +305,7 @@ if (!quick) pr_err("%s:%s %s\n", list[i].host, list[i].path, clnt_spcreateerror( - "server not responding")); + "server not responding")); continue; } /* @@ -334,8 +334,8 @@ clnt_control(cl, CLSET_RETRY_TIMEOUT, (char *)&timeout); timeout.tv_sec = 25; rpc_stat = clnt_call(cl, MOUNTPROC_UMNT, xdr_dirpath, - (char *)&list[i].path, xdr_void, (char *)NULL, - timeout); + (char *)&list[i].path, xdr_void, (char *)NULL, + timeout); AUTH_DESTROY(cl->cl_auth); clnt_destroy(cl); if (rpc_stat == RPC_PROGVERSMISMATCH && vers == MOUNTVERS) { @@ -361,7 +361,6 @@ { kstat_ctl_t *kc = NULL; /* libkstat cookie */ kstat_t *ksp; - ulong_t fsid; struct mntinfo_kstat mik; if (mntp == NULL) --- old/usr/src/lib/librpcsvc/Makefile.com Mon Oct 29 22:52:08 2007 +++ new/usr/src/lib/librpcsvc/Makefile.com Mon Oct 29 22:52:08 2007 @@ -45,9 +45,12 @@ $(COMPILE.c) -o $@ $< $(POST_PROCESS_O) -LIBS = $(DYNLIB) +LIBS = $(DYNLIB) $(LINTLIB) CPPFLAGS += -DYP + +$(LINTLIB):= SRCS = $(SRCDIR)/$(LINTSRC) + LDLIBS += -lnsl -lc .KEEP_STATE: --- old/usr/src/lib/librpcsvc/i386/Makefile Mon Oct 29 22:52:09 2007 +++ new/usr/src/lib/librpcsvc/i386/Makefile Mon Oct 29 22:52:08 2007 @@ -29,4 +29,4 @@ all: $(LIBS) -install: all $(ROOTLIBS) $(ROOTLINKS) +install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT) --- old/usr/src/lib/librpcsvc/sparc/Makefile Mon Oct 29 22:52:10 2007 +++ new/usr/src/lib/librpcsvc/sparc/Makefile Mon Oct 29 22:52:09 2007 @@ -29,4 +29,4 @@ all: $(LIBS) -install: all $(ROOTLIBS) $(ROOTLINKS) +install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT) --- old/usr/src/lib/librpcsvc/sparcv9/Makefile Mon Oct 29 22:52:11 2007 +++ new/usr/src/lib/librpcsvc/sparcv9/Makefile Mon Oct 29 22:52:10 2007 @@ -30,4 +30,4 @@ all: $(LIBS) -install: all $(ROOTLIBS64) $(ROOTLINKS64) +install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT) --- old/usr/src/pkgdefs/SUNWarc/prototype_com Mon Oct 29 22:52:12 2007 +++ new/usr/src/pkgdefs/SUNWarc/prototype_com Mon Oct 29 22:52:11 2007 @@ -159,6 +159,8 @@ f none usr/lib/llib-lrcm.ln 644 root bin s none usr/lib/llib-lresolv=../../lib/llib-lresolv s none usr/lib/llib-lresolv.ln=../../lib/llib-lresolv.ln +s none usr/lib/llib-lrpcsvc=../../lib/llib-lrpcsvc +s none usr/lib/llib-lrpcsvc.ln=../../lib/llib-lrpcsvc.ln s none usr/lib/llib-lrt=../../lib/llib-lrt s none usr/lib/llib-lrt.ln=../../lib/llib-lrt.ln s none usr/lib/llib-lrtld_db=../../lib/llib-lrtld_db --- old/usr/src/pkgdefs/SUNWarc/prototype_i386 Mon Oct 29 22:52:12 2007 +++ new/usr/src/pkgdefs/SUNWarc/prototype_i386 Mon Oct 29 22:52:12 2007 @@ -117,6 +117,7 @@ f none usr/lib/amd64/llib-l450.ln 644 root bin s none usr/lib/amd64/llib-lpthread.ln=../../../lib/amd64/llib-lpthread.ln s none usr/lib/amd64/llib-lresolv.ln=../../../lib/amd64/llib-lresolv.ln +s none usr/lib/amd64/llib-lrpcsvc.ln=../../../lib/amd64/llib-lrpcsvc.ln s none usr/lib/amd64/llib-lrt.ln=../../../lib/amd64/llib-lrt.ln s none usr/lib/amd64/llib-lrtld_db.ln=../../../lib/amd64/llib-lrtld_db.ln f none usr/lib/amd64/llib-lpasswdutil.ln 644 root bin --- old/usr/src/pkgdefs/SUNWarc/prototype_sparc Mon Oct 29 22:52:13 2007 +++ new/usr/src/pkgdefs/SUNWarc/prototype_sparc Mon Oct 29 22:52:13 2007 @@ -113,6 +113,7 @@ f none usr/lib/sparcv9/llib-l450.ln 644 root bin s none usr/lib/sparcv9/llib-lpthread.ln=../../../lib/sparcv9/llib-lpthread.ln s none usr/lib/sparcv9/llib-lresolv.ln=../../../lib/sparcv9/llib-lresolv.ln +s none usr/lib/sparcv9/llib-lrpcsvc.ln=../../../lib/sparcv9/llib-lrpcsvc.ln s none usr/lib/sparcv9/llib-lrt.ln=../../../lib/sparcv9/llib-lrt.ln s none usr/lib/sparcv9/llib-lrtld_db.ln=../../../lib/sparcv9/llib-lrtld_db.ln s none usr/lib/sparcv9/llib-lposix4.ln=../../../lib/sparcv9/llib-lrt.ln --- old/usr/src/pkgdefs/SUNWarcr/prototype_com Mon Oct 29 22:52:14 2007 +++ new/usr/src/pkgdefs/SUNWarcr/prototype_com Mon Oct 29 22:52:13 2007 @@ -100,6 +100,8 @@ f none lib/llib-lpthread.ln 644 root bin f none lib/llib-lresolv 644 root bin f none lib/llib-lresolv.ln 644 root bin +f none lib/llib-lrpcsvc 644 root bin +f none lib/llib-lrpcsvc.ln 644 root bin f none lib/llib-lrt 644 root bin f none lib/llib-lrt.ln 644 root bin f none lib/llib-lrtld_db 644 root bin --- old/usr/src/pkgdefs/SUNWarcr/prototype_i386 Mon Oct 29 22:52:15 2007 +++ new/usr/src/pkgdefs/SUNWarcr/prototype_i386 Mon Oct 29 22:52:14 2007 @@ -79,6 +79,7 @@ s none lib/amd64/llib-lposix4.ln=./llib-lrt.ln f none lib/amd64/llib-lpthread.ln 644 root bin f none lib/amd64/llib-lresolv.ln 644 root bin +f none lib/amd64/llib-lrpcsvc.ln 644 root bin f none lib/amd64/llib-lrt.ln 644 root bin f none lib/amd64/llib-lrtld_db.ln 644 root bin f none lib/amd64/llib-lscf.ln 644 root bin --- old/usr/src/pkgdefs/SUNWarcr/prototype_sparc Mon Oct 29 22:52:16 2007 +++ new/usr/src/pkgdefs/SUNWarcr/prototype_sparc Mon Oct 29 22:52:15 2007 @@ -79,6 +79,7 @@ s none lib/sparcv9/llib-lposix4.ln=./llib-lrt.ln f none lib/sparcv9/llib-lpthread.ln 644 root bin f none lib/sparcv9/llib-lresolv.ln 644 root bin +f none lib/sparcv9/llib-lrpcsvc.ln 644 root bin f none lib/sparcv9/llib-lrt.ln 644 root bin f none lib/sparcv9/llib-lrtld_db.ln 644 root bin f none lib/sparcv9/llib-lscf.ln 0644 root bin