74 #include "mountd.h" |
74 #include "mountd.h" |
75 #include <tsol/label.h> |
75 #include <tsol/label.h> |
76 #include <sys/tsol/label_macro.h> |
76 #include <sys/tsol/label_macro.h> |
77 #include <libtsnet.h> |
77 #include <libtsnet.h> |
78 #include <sys/sdt.h> |
78 #include <sys/sdt.h> |
|
79 #include <libscf.h> |
|
80 #include <limits.h> |
79 #include <sys/nvpair.h> |
81 #include <sys/nvpair.h> |
80 #include <attr.h> |
82 #include <attr.h> |
|
83 #include "smfcfg.h" |
81 |
84 |
82 extern int daemonize_init(void); |
85 extern int daemonize_init(void); |
83 extern void daemonize_fini(int fd); |
86 extern void daemonize_fini(int fd); |
84 |
87 |
85 struct sh_list *share_list; |
88 struct sh_list *share_list; |
410 } |
415 } |
411 |
416 |
412 /* |
417 /* |
413 * Read in the NFS version values from config file. |
418 * Read in the NFS version values from config file. |
414 */ |
419 */ |
415 if ((defopen(NFSADMIN)) == 0) { |
420 bufsz = 4; |
416 char *defval; |
421 ret = nfs_smf_get_prop("server_versmin", defval, DEFAULT_INSTANCE, |
417 int defvers; |
422 SCF_TYPE_INTEGER, NFSD, &bufsz); |
418 |
423 if (ret == SA_OK) { |
419 if ((defval = defread("NFS_SERVER_VERSMIN=")) != NULL) { |
424 errno = 0; |
420 errno = 0; |
425 defvers = strtol(defval, (char **)NULL, 10); |
421 defvers = strtol(defval, (char **)NULL, 10); |
426 if (errno == 0) { |
422 if (errno == 0) { |
427 mount_vers_min = defvers; |
423 mount_vers_min = defvers; |
428 /* |
424 /* |
429 * special because NFSv2 is |
425 * special because NFSv2 is |
430 * supported by mount v1 & v2 |
426 * supported by mount v1 & v2 |
431 */ |
427 */ |
432 if (defvers == NFS_VERSION) |
428 if (defvers == NFS_VERSION) |
433 mount_vers_min = MOUNTVERS; |
429 mount_vers_min = MOUNTVERS; |
434 } |
430 } |
435 } |
431 } |
436 |
432 if ((defval = defread("NFS_SERVER_VERSMAX=")) != NULL) { |
437 bufsz = 4; |
433 errno = 0; |
438 ret = nfs_smf_get_prop("server_versmax", defval, DEFAULT_INSTANCE, |
434 defvers = strtol(defval, (char **)NULL, 10); |
439 SCF_TYPE_INTEGER, NFSD, &bufsz); |
435 if (errno == 0) { |
440 if (ret == SA_OK) { |
436 mount_vers_max = defvers; |
441 errno = 0; |
437 } |
442 defvers = strtol(defval, (char **)NULL, 10); |
438 } |
443 if (errno == 0) { |
439 |
444 mount_vers_max = defvers; |
440 /* close defaults file */ |
445 } |
441 defopen(NULL); |
|
442 } |
446 } |
443 |
447 |
444 /* |
448 /* |
445 * Sanity check versions, |
449 * Sanity check versions, |
446 * even though we may get versions > MOUNTVERS3, we still need |
450 * even though we may get versions > MOUNTVERS3, we still need |
447 * to start nfsauth service, so continue on regardless of values. |
451 * to start nfsauth service, so continue on regardless of values. |
448 */ |
452 */ |
449 if (mount_vers_min > mount_vers_max) { |
453 if (mount_vers_min > mount_vers_max) { |
450 fprintf(stderr, "NFS_SERVER_VERSMIN > NFS_SERVER_VERSMAX"); |
454 fprintf(stderr, "server_versmin > server_versmax"); |
451 mount_vers_max = mount_vers_min; |
455 mount_vers_max = mount_vers_min; |
452 } |
456 } |
453 (void) setlocale(LC_ALL, ""); |
457 (void) setlocale(LC_ALL, ""); |
454 (void) rwlock_init(&sharetab_lock, USYNC_THREAD, NULL); |
458 (void) rwlock_init(&sharetab_lock, USYNC_THREAD, NULL); |
455 (void) mutex_init(&mnttab_lock, USYNC_THREAD, NULL); |
459 (void) mutex_init(&mnttab_lock, USYNC_THREAD, NULL); |