Print this page
OS-5221 nfs mount should work without /etc/nfssec.conf inside LX zoneroot
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fs.d/nfs/lib/nfs_sec.c
          +++ new/usr/src/cmd/fs.d/nfs/lib/nfs_sec.c
↓ open down ↓ 37 lines elided ↑ open up ↑
  38   38   */
  39   39  
  40   40  /* SVr4.0 1.18  */
  41   41  
  42   42  #include <stdio.h>
  43   43  #include <string.h>
  44   44  #include <ctype.h>
  45   45  #include <stdlib.h>
  46   46  #include <syslog.h>
  47   47  #include <synch.h>
       48 +#include <zone.h>
  48   49  #include <rpc/rpc.h>
  49   50  #include <nfs/nfs_sec.h>
  50   51  #include <rpc/rpcsec_gss.h>
  51   52  #ifdef WNFS_SEC_NEGO
  52   53  #include "webnfs.h"
  53   54  #endif
  54   55  
  55   56  #define GETBYNAME       1
  56   57  #define GETBYNUM        2
  57   58  
↓ open down ↓ 642 lines elided ↑ open up ↑
 700  701   *  Get seconfig from /etc/nfssec.conf by name or by number or
 701  702   *  by descriptior.
 702  703   */
 703  704  /* ARGSUSED */
 704  705  static int
 705  706  get_seconfig(int whichway, char *name, int num,
 706  707                  rpc_gss_service_t service, seconfig_t *entryp)
 707  708  {
 708  709          char    line[BUFSIZ];   /* holds each line of NFSSEC_CONF */
 709  710          FILE    *fp;            /* file stream for NFSSEC_CONF */
      711 +        char    nfssec_conf[MAXPATHLEN];
      712 +        const char *zroot = zone_get_nroot();
 710  713  
 711  714          if ((whichway == GETBYNAME) && (name == NULL))
 712  715                  return (SC_NOTFOUND);
 713  716  
      717 +        (void) snprintf(nfssec_conf, sizeof (nfssec_conf), "%s%s", zroot != NULL ?
      718 +            zroot : "", NFSSEC_CONF);
      719 +
 714  720          (void) mutex_lock(&matching_lock);
 715      -        if ((fp = fopen(NFSSEC_CONF, "r")) == NULL) {
      721 +        if ((fp = fopen(nfssec_conf, "r")) == NULL) {
 716  722                  (void) mutex_unlock(&matching_lock);
 717  723                  return (SC_OPENFAIL);
 718  724          }
 719  725  
 720  726          while (fgets(line, BUFSIZ, fp)) {
 721  727                  if (!(blank(line) || comment(line))) {
 722  728                          switch (whichway) {
 723  729                                  case GETBYNAME:
 724  730                                          if (matchname(line, name, entryp)) {
 725  731                                                  goto found;
↓ open down ↓ 351 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX