diff options
46 files changed, 744 insertions, 624 deletions
diff --git a/exception_lists/check_rtime b/exception_lists/check_rtime index fce897b09b..0fbbfb639e 100644 --- a/exception_lists/check_rtime +++ b/exception_lists/check_rtime @@ -47,7 +47,6 @@ SKIP ^usr/src/ # no objects in source code # Individual files that we don't examine SKIP ^boot/grub/bin/grub$ -SKIP ^usr/apache/libexec/mod_ipp.so$ # Apache loadable module # USIII specific extns. cause ldd noise on USII bld. m/c SKIP ^usr/lib/fps/sun4u/UltraSPARC.*/fptest$ SKIP ^usr/MACH(lib)/lddstub$ # lddstub has no dependencies diff --git a/exception_lists/copyright b/exception_lists/copyright index 37c48c548f..4f3c232f39 100644 --- a/exception_lists/copyright +++ b/exception_lists/copyright @@ -68,6 +68,11 @@ usr/src/common/bzip2/huffman.c usr/src/common/openssl/crypto/krb5/krb5_asn.c usr/src/common/openssl/crypto/krb5/krb5_asn.h usr/src/grub/grub-0.97/stage2/Makefile.am +usr/src/grub/grub-0.97/stage2/builtins.c +usr/src/grub/grub-0.97/stage2/disk_io.c +usr/src/grub/grub-0.97/stage2/pc_slice.h +usr/src/grub/grub-0.97/stage2/gpt.h +usr/src/grub/grub-0.97/stage2/shared.h usr/src/lib/gss_mechs/mech_krb5/crypto/cksumtype_to_string.c usr/src/lib/gss_mechs/mech_krb5/crypto/coll_proof_cksum.c usr/src/lib/gss_mechs/mech_krb5/crypto/enctype_compare.c diff --git a/exception_lists/cstyle b/exception_lists/cstyle index 67bbe870f0..410608488e 100644 --- a/exception_lists/cstyle +++ b/exception_lists/cstyle @@ -126,6 +126,11 @@ usr/src/common/bzip2/huffman.c usr/src/common/crypto/chacha/chacha.c usr/src/common/openssl/crypto/krb5/krb5_asn.c usr/src/common/openssl/crypto/krb5/krb5_asn.h +usr/src/grub/grub-0.97/stage2/builtins.c +usr/src/grub/grub-0.97/stage2/disk_io.c +usr/src/grub/grub-0.97/stage2/pc_slice.h +usr/src/grub/grub-0.97/stage2/gpt.h +usr/src/grub/grub-0.97/stage2/shared.h usr/src/lib/libc/port/gen/arc4random_uniform.c usr/src/lib/gss_mechs/mech_krb5/crypto/aes/aes_s2k.c usr/src/lib/gss_mechs/mech_krb5/crypto/cksumtype_to_string.c diff --git a/exception_lists/hdrchk b/exception_lists/hdrchk index 1259c43949..0c8d0286ef 100644 --- a/exception_lists/hdrchk +++ b/exception_lists/hdrchk @@ -30,6 +30,7 @@ usr/src/cmd/mandoc/mdoc.h usr/src/cmd/mandoc/out.h usr/src/cmd/mandoc/term.h usr/src/common/openssl/crypto/krb5/krb5_asn.h +usr/src/grub/grub-0.97/stage2/shared.h usr/src/lib/gss_mechs/mech_krb5/et/error_table.h usr/src/lib/gss_mechs/mech_krb5/et/internal.h usr/src/lib/gss_mechs/mech_krb5/et/mit-sipb-copyright.h diff --git a/exception_lists/interface_check b/exception_lists/interface_check index 377aa4b387..311bed5bc6 100644 --- a/exception_lists/interface_check +++ b/exception_lists/interface_check @@ -43,7 +43,6 @@ # Plugins are not required to have versioned file names, and are not required # to be internally versioned. # -PLUGIN ^usr/apache/libexec PLUGIN ^usr/lib/devfsadm PLUGIN ^usr/lib/efcode/.*\.so$ PLUGIN ^usr/lib/elfedit @@ -53,6 +52,7 @@ PLUGIN ^usr/lib/fm/topo/plugins PLUGIN ^usr/lib/fwflash PLUGIN ^usr/lib/iconv PLUGIN ^usr/lib/inet/ppp +PLUGIN ^usr/lib/lp/ipp PLUGIN ^usr/lib/mdb PLUGIN ^usr/lib/pci PLUGIN ^usr/lib/picl/plugins @@ -17188,9 +17188,11 @@ s usr/share/man/man3socket/endnetent.3socket=getnetbyname.3socket s usr/share/man/man3socket/endprotoent.3socket=getprotobyname.3socket s usr/share/man/man3socket/endservent.3socket=getservbyname.3socket s usr/share/man/man3socket/ether_aton.3socket=ethers.3socket +s usr/share/man/man3socket/ether_aton_r.3socket=ethers.3socket s usr/share/man/man3socket/ether_hostton.3socket=ethers.3socket s usr/share/man/man3socket/ether_line.3socket=ethers.3socket s usr/share/man/man3socket/ether_ntoa.3socket=ethers.3socket +s usr/share/man/man3socket/ether_ntoa_r.3socket=ethers.3socket s usr/share/man/man3socket/ether_ntohost.3socket=ethers.3socket f usr/share/man/man3socket/ethers.3socket 0444 root bin s usr/share/man/man3socket/freeaddrinfo.3socket=getaddrinfo.3socket diff --git a/usr/src/cmd/boot/bootadm/bootadm.c b/usr/src/cmd/boot/bootadm/bootadm.c index c9466725f5..454b266d45 100644 --- a/usr/src/cmd/boot/bootadm/bootadm.c +++ b/usr/src/cmd/boot/bootadm/bootadm.c @@ -24,7 +24,7 @@ */ /* - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ /* @@ -116,6 +116,9 @@ typedef struct { #define ENTRY_INIT -1 /* entryNum initial value */ #define ALL_ENTRIES -2 /* selects all boot entries */ +#define PARTNO_NOTFOUND -1 /* Solaris partition not found */ +#define PARTNO_EFI -2 /* EFI partition table found */ + #define GRUB_DIR "/boot/grub" #define GRUB_STAGE2 GRUB_DIR "/stage2" #define GRUB_MENU "/boot/grub/menu.lst" @@ -4916,14 +4919,14 @@ create_diskmap(char *osroot) static int get_partition(char *device) { - int i, fd, is_pcfs, partno = -1; + int i, fd, is_pcfs, partno = PARTNO_NOTFOUND; struct mboot *mboot; char boot_sect[SECTOR_SIZE]; char *wholedisk, *slice; #ifdef i386 ext_part_t *epp; uint32_t secnum, numsec; - int rval, pno, ext_partno = -1; + int rval, pno, ext_partno = PARTNO_NOTFOUND; #endif /* form whole disk (p0) */ @@ -4979,6 +4982,11 @@ get_partition(char *device) break; } } else { /* look for solaris partition, old and new */ + if (part->systid == EFI_PMBR) { + partno = PARTNO_EFI; + break; + } + #ifdef i386 if ((part->systid == SUNIXOS && (fdisk_is_linux_swap(epp, part->relsect, @@ -4999,7 +5007,7 @@ get_partition(char *device) } #ifdef i386 /* If no primary solaris partition, check extended partition */ - if ((partno == -1) && (ext_partno != -1)) { + if ((partno == PARTNO_NOTFOUND) && (ext_partno != PARTNO_NOTFOUND)) { rval = fdisk_get_solaris_part(epp, &pno, &secnum, &numsec); if (rval == FDISK_SUCCESS) { partno = pno - 1; @@ -5072,13 +5080,18 @@ get_grubroot(char *osroot, char *osdev, char *menu_root) } fdiskpart = get_partition(osdev); - INJECT_ERROR1("GRUBROOT_FDISK_FAIL", fdiskpart = -1); - if (fdiskpart == -1) { + INJECT_ERROR1("GRUBROOT_FDISK_FAIL", fdiskpart = PARTNO_NOTFOUND); + if (fdiskpart == PARTNO_NOTFOUND) { bam_error(FDISKPART_FAIL, osdev); return (NULL); } grubroot = s_calloc(1, 10); + if (fdiskpart == PARTNO_EFI) { + fdiskpart = atoi(&slice[1]); + slice = NULL; + } + if (slice) { (void) snprintf(grubroot, 10, "(hd%s,%d,%c)", grubhd, fdiskpart, slice[1] + 'a' - '0'); @@ -7103,8 +7116,8 @@ get_grubsign(char *osroot, char *osdev) bam_print(GRUBSIGN_FOUND_OR_CREATED, sign, osdev); fdiskpart = get_partition(osdev); - INJECT_ERROR1("GET_GRUBSIGN_FDISK", fdiskpart = -1); - if (fdiskpart == -1) { + INJECT_ERROR1("GET_GRUBSIGN_FDISK", fdiskpart = PARTNO_NOTFOUND); + if (fdiskpart == PARTNO_NOTFOUND) { bam_error(FDISKPART_FAIL, osdev); free(sign); return (NULL); @@ -7112,6 +7125,11 @@ get_grubsign(char *osroot, char *osdev) slice = strrchr(osdev, 's'); + if (fdiskpart == PARTNO_EFI) { + fdiskpart = atoi(&slice[1]); + slice = NULL; + } + grubsign = s_calloc(1, MAXNAMELEN + 10); if (slice) { (void) snprintf(grubsign, MAXNAMELEN + 10, "(%s,%d,%c)", diff --git a/usr/src/cmd/boot/installgrub/Makefile b/usr/src/cmd/boot/installgrub/Makefile index 4cc69eccd5..aecf0f7096 100644 --- a/usr/src/cmd/boot/installgrub/Makefile +++ b/usr/src/cmd/boot/installgrub/Makefile @@ -19,6 +19,7 @@ # CDDL HEADER END # # Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2015, Nexenta Systems, Inc. # PROG= installgrub @@ -45,7 +46,7 @@ LDLIBS += -lmd5 i386_CFLAGS += -D_LARGEFILE64_SOURCE i386_CFLAGS += -D_FILE_OFFSET_BITS=64 -LDLIBS += -lfdisk +LDLIBS += -lfdisk -lefi -lfstyp LINTFLAGS += \ -erroff=E_BAD_PTR_CAST_ALIGN \ diff --git a/usr/src/cmd/boot/installgrub/installgrub.c b/usr/src/cmd/boot/installgrub/installgrub.c index c27dca802b..4d29d0236e 100644 --- a/usr/src/cmd/boot/installgrub/installgrub.c +++ b/usr/src/cmd/boot/installgrub/installgrub.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2012 Milan Jurik. All rights reserved. - * Copyright 2012 Nexenta Systems, Inc. All rights reserved. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ #include <stdio.h> @@ -48,6 +48,10 @@ #include <sys/stat.h> #include <sys/multiboot.h> #include <sys/sysmacros.h> +#include <sys/efi_partition.h> + +#include <libnvpair.h> +#include <libfstyp.h> #include "message.h" #include "installgrub.h" @@ -107,7 +111,7 @@ static void usage(char *); static int read_stage1_from_file(char *, ig_data_t *); static int read_stage2_from_file(char *, ig_data_t *); static int read_stage1_from_disk(int, char *); -static int read_stage2_from_disk(int, ig_stage2_t *); +static int read_stage2_from_disk(int, ig_stage2_t *, int); static int prepare_stage1(ig_data_t *); static int prepare_stage2(ig_data_t *, char *); static void prepare_fake_multiboot(ig_stage2_t *); @@ -389,7 +393,7 @@ handle_getinfo(char *progname, char **argv) goto out_dev; } - ret = read_stage2_from_disk(device->part_fd, stage2); + ret = read_stage2_from_disk(device->part_fd, stage2, device->type); if (ret == BC_ERROR) { (void) fprintf(stderr, gettext("Error reading stage2 from " "%s\n"), device_path); @@ -487,7 +491,8 @@ handle_mirror(char *progname, char **argv) goto out_devs; } - ret = read_stage2_from_disk(curr_device->part_fd, stage2_curr); + ret = read_stage2_from_disk(curr_device->part_fd, stage2_curr, + curr_device->type); if (ret == BC_ERROR) { BOOT_DEBUG("Error reading first stage2 blocks from %s\n", curr_device->path); @@ -623,6 +628,10 @@ propagate_bootblock(ig_data_t *source, ig_data_t *target, char *updt_str) static int init_device(ig_device_t *device, char *path) { + struct dk_gpt *vtoc; + fstyp_handle_t fhdl; + const char *fident; + bzero(device, sizeof (*device)); device->part_fd = -1; device->disk_fd = -1; @@ -655,9 +664,25 @@ init_device(ig_device_t *device, char *path) return (BC_ERROR); } + if (efi_alloc_and_read(device->disk_fd, &vtoc) > 0) { + device->type = IG_DEV_EFI; + efi_free(vtoc); + } + if (get_raw_partition_fd(device) != BC_SUCCESS) return (BC_ERROR); + if (fstyp_init(device->part_fd, 0, NULL, &fhdl) != 0) + return (BC_ERROR); + + if (fstyp_ident(fhdl, "zfs", &fident) != 0) { + fstyp_fini(fhdl); + (void) fprintf(stderr, gettext("Booting of EFI labeled disks " + "is only supported with ZFS\n")); + return (BC_ERROR); + } + fstyp_fini(fhdl); + if (get_start_sector(device) != BC_SUCCESS) return (BC_ERROR); @@ -701,6 +726,21 @@ get_start_sector(ig_device_t *device) struct part_info dkpi; struct extpart_info edkpi; + if (is_efi(device->type)) { + struct dk_gpt *vtoc; + + if (efi_alloc_and_read(device->disk_fd, &vtoc) <= 0) + return (BC_ERROR); + + device->start_sector = vtoc->efi_parts[device->slice].p_start; + /* GPT doesn't use traditional slice letters */ + device->slice = 0xff; + device->partition = 0; + + efi_free(vtoc); + goto found_part; + } + mboot = (struct mboot *)device->boot_sector; if (is_bootpar(device->type)) { @@ -959,7 +999,8 @@ write_stage2(ig_data_t *install) * Note that we use stage2->buf rather than stage2->file, because we * may have extended information after the latter. */ - offset = STAGE2_BLKOFF * SECTOR_SIZE; + offset = STAGE2_BLKOFF(device->type) * SECTOR_SIZE; + if (write_out(device->part_fd, stage2->buf, stage2->buf_size, offset) != BC_SUCCESS) { perror("write"); @@ -968,7 +1009,7 @@ write_stage2(ig_data_t *install) /* Simulate the "old" installgrub output. */ (void) fprintf(stdout, WRITE_STAGE2_DISK, device->partition, - (stage2->buf_size / SECTOR_SIZE) + 1, STAGE2_BLKOFF, + (stage2->buf_size / SECTOR_SIZE) + 1, STAGE2_BLKOFF(device->type), stage2->first_sector); return (BC_SUCCESS); @@ -1162,7 +1203,7 @@ read_stage1_from_disk(int dev_fd, char *stage1_buf) } static int -read_stage2_from_disk(int dev_fd, ig_stage2_t *stage2) +read_stage2_from_disk(int dev_fd, ig_stage2_t *stage2, int type) { uint32_t size; uint32_t buf_size; @@ -1173,7 +1214,7 @@ read_stage2_from_disk(int dev_fd, ig_stage2_t *stage2) assert(dev_fd != -1); if (read_in(dev_fd, mboot_scan, sizeof (mboot_scan), - STAGE2_BLKOFF * SECTOR_SIZE) != BC_SUCCESS) { + STAGE2_BLKOFF(type) * SECTOR_SIZE) != BC_SUCCESS) { perror(gettext("Error reading stage2 sectors")); return (BC_ERROR); } @@ -1209,7 +1250,7 @@ read_stage2_from_disk(int dev_fd, ig_stage2_t *stage2) } stage2->buf_size = buf_size; - if (read_in(dev_fd, stage2->buf, buf_size, STAGE2_BLKOFF * + if (read_in(dev_fd, stage2->buf, buf_size, STAGE2_BLKOFF(type) * SECTOR_SIZE) != BC_SUCCESS) { perror("read"); free(stage2->buf); @@ -1243,7 +1284,8 @@ is_update_necessary(ig_data_t *data, char *updt_str) bzero(&stage2_disk, sizeof (ig_stage2_t)); /* Gather stage2 (if present) from the target device. */ - if (read_stage2_from_disk(dev_fd, &stage2_disk) != BC_SUCCESS) { + if (read_stage2_from_disk(dev_fd, &stage2_disk, device->type) + != BC_SUCCESS) { BOOT_DEBUG("Unable to read stage2 from %s\n", device->path); BOOT_DEBUG("No multiboot wrapped stage2 on %s\n", device->path); return (B_TRUE); @@ -1367,7 +1409,8 @@ prepare_stage2(ig_data_t *install, char *updt_str) } } else { /* Solaris VTOC */ - stage2->first_sector = device->start_sector + STAGE2_BLKOFF; + stage2->first_sector = device->start_sector + + STAGE2_BLKOFF(device->type); BOOT_DEBUG("stage2 first sector: %d\n", stage2->first_sector); /* * In a solaris partition, stage2 is written to contiguous @@ -1441,15 +1484,18 @@ get_raw_partition_path(ig_device_t *device) } len = strlen(raw); - if (raw[len - 2] != 's' || raw[len - 1] == '2') { + if (!is_efi(device->type) && + (raw[len - 2] != 's' || raw[len - 1] == '2')) { (void) fprintf(stderr, NOT_ROOT_SLICE); free(raw); return (NULL); } device->slice = atoi(&raw[len - 1]); - raw[len - 2] = 's'; - raw[len - 1] = '2'; + if (!is_efi(device->type)) { + raw[len - 2] = 's'; + raw[len - 1] = '2'; + } return (raw); } diff --git a/usr/src/cmd/boot/installgrub/installgrub.h b/usr/src/cmd/boot/installgrub/installgrub.h index af6e60b973..037ffad4ce 100644 --- a/usr/src/cmd/boot/installgrub/installgrub.h +++ b/usr/src/cmd/boot/installgrub/installgrub.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012 Nexenta Systems, Inc. All rights reserved. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ #ifndef _INSTALLGRUB_H @@ -68,10 +68,12 @@ typedef struct _ig_data { enum ig_devtype_t { IG_DEV_X86BOOTPAR = 1, - IG_DEV_SOLVTOC + IG_DEV_SOLVTOC, + IG_DEV_EFI }; #define is_bootpar(type) (type == IG_DEV_X86BOOTPAR) +#define is_efi(type) (type == IG_DEV_EFI) #define STAGE2_MEMADDR (0x8000) /* loading addr of stage2 */ @@ -86,7 +88,8 @@ enum ig_devtype_t { #define STAGE2_BLOCKLIST (SECTOR_SIZE - 0x8) #define STAGE2_INSTALLPART (SECTOR_SIZE + 0x8) #define STAGE2_FORCE_LBA (SECTOR_SIZE + 0x11) -#define STAGE2_BLKOFF (50) /* offset from start of fdisk part */ +#define STAGE2_BLKOFF(type) \ + (is_efi(type) ? 1024 : 50) /* offset from start of part */ #ifdef __cplusplus } diff --git a/usr/src/cmd/lp/cmd/lpsched/print-svc b/usr/src/cmd/lp/cmd/lpsched/print-svc index 97c48a9c68..ff6599faf9 100644 --- a/usr/src/cmd/lp/cmd/lpsched/print-svc +++ b/usr/src/cmd/lp/cmd/lpsched/print-svc @@ -120,7 +120,7 @@ fi FMRI=$2 IPP_FMRI="svc:/application/print/ipp-listener:default" RFC1179_FMRI="svc:/application/print/rfc1179:default" - IPP_CONF=/etc/apache/httpd-standalone-ipp.conf + IPP_CONF=/etc/lp/ipp/httpd-standalone-ipp.conf ip="any" policy=`get_policy $FMRI` diff --git a/usr/src/cmd/rpcinfo/rpcinfo.c b/usr/src/cmd/rpcinfo/rpcinfo.c index 702a628980..34051052e8 100644 --- a/usr/src/cmd/rpcinfo/rpcinfo.c +++ b/usr/src/cmd/rpcinfo/rpcinfo.c @@ -1581,20 +1581,22 @@ progping(netid, argc, argv) static void usage() { - (void) fprintf(stderr, "Usage: rpcinfo [-m | -s] [host]\n"); + (void) fprintf(stderr, "Usage: rpcinfo [-T netid] [-m | -s] [host]\n"); #ifdef PORTMAP (void) fprintf(stderr, " rpcinfo -p [host]\n"); #endif (void) fprintf(stderr, " rpcinfo -T netid host prognum [versnum]\n"); - (void) fprintf(stderr, " rpcinfo -l host prognum versnum\n"); + (void) fprintf(stderr, + " rpcinfo -l [-T netid] host prognum versnum\n"); #ifdef PORTMAP (void) fprintf(stderr, -" rpcinfo [-n portnum] -u | -t host prognum [versnum]\n"); + " rpcinfo [-n portnum] -u | -t host prognum [versnum]\n"); #endif (void) fprintf(stderr, -" rpcinfo -a serv_address -T netid prognum [version]\n"); - (void) fprintf(stderr, " rpcinfo -b prognum versnum\n"); + " rpcinfo -a serv_address -T netid prognum [versnum]\n"); + (void) fprintf(stderr, + " rpcinfo -b [-T netid] prognum versnum\n"); (void) fprintf(stderr, " rpcinfo -d [-T netid] prognum versnum\n"); } diff --git a/usr/src/grub/grub-0.97/stage2/builtins.c b/usr/src/grub/grub-0.97/stage2/builtins.c index c67ed4bc9b..ddc0003995 100644 --- a/usr/src/grub/grub-0.97/stage2/builtins.c +++ b/usr/src/grub/grub-0.97/stage2/builtins.c @@ -1654,8 +1654,8 @@ harddisk: for (drive = 0x80; drive < 0x88; drive++) { unsigned long part = 0xFFFFFF; - unsigned long start, len, offset, ext_offset; - int type, entry; + unsigned long start, len, offset, ext_offset, gpt_offset; + int type, entry, gpt_count, gpt_size; char buf[SECTOR_SIZE]; if (for_root && tmp_argpart) { @@ -1685,7 +1685,8 @@ harddisk: current_drive = drive; while (next_partition (drive, 0xFFFFFF, &part, &type, &start, &len, &offset, &entry, - &ext_offset, buf)) + &ext_offset, &gpt_offset, + &gpt_count, &gpt_size, buf)) { if (type != PC_SLICE_TYPE_NONE && ! IS_PC_SLICE_TYPE_BSD (type) @@ -3378,8 +3379,8 @@ parttype_func (char *arg, int flags) { int new_type; unsigned long part = 0xFFFFFF; - unsigned long start, len, offset, ext_offset; - int entry, type; + unsigned long start, len, offset, ext_offset, gpt_offset; + int entry, type, gpt_count, gpt_size; char mbr[512]; /* Get the drive and the partition. */ @@ -3416,8 +3417,15 @@ parttype_func (char *arg, int flags) /* Look for the partition. */ while (next_partition (current_drive, 0xFFFFFF, &part, &type, &start, &len, &offset, &entry, - &ext_offset, mbr)) + &ext_offset, &gpt_offset, &gpt_count, &gpt_size, mbr)) { + /* The partition may not be a GPT partition. */ + if (gpt_offset != 0) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + if (part == current_partition) { /* Found. */ diff --git a/usr/src/grub/grub-0.97/stage2/disk_io.c b/usr/src/grub/grub-0.97/stage2/disk_io.c index 5e767dc747..6f21277dae 100644 --- a/usr/src/grub/grub-0.97/stage2/disk_io.c +++ b/usr/src/grub/grub-0.97/stage2/disk_io.c @@ -21,6 +21,7 @@ #include <shared.h> #include <filesys.h> +#include <gpt.h> #ifdef SUPPORT_NETBOOT # include <grub.h> @@ -514,8 +515,8 @@ int set_partition_hidden_flag (int hidden) { unsigned long part = 0xFFFFFF; - unsigned long start, len, offset, ext_offset; - int entry, type; + unsigned long start, len, offset, ext_offset, gpt_offset; + int entry, type, gpt_count, gpt_size; char mbr[512]; /* The drive must be a hard disk. */ @@ -536,8 +537,15 @@ set_partition_hidden_flag (int hidden) /* Look for the partition. */ while (next_partition (current_drive, 0xFFFFFF, &part, &type, &start, &len, &offset, &entry, - &ext_offset, mbr)) + &ext_offset, &gpt_offset, &gpt_count, &gpt_size, mbr)) { + /* The partition may not be a GPT partition. */ + if (gpt_offset != 0) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + if (part == current_partition) { /* Found. */ @@ -589,12 +597,15 @@ next_partition (unsigned long drive, unsigned long dest, unsigned long *partition, int *type, unsigned long *start, unsigned long *len, unsigned long *offset, int *entry, - unsigned long *ext_offset, char *buf) + unsigned long *ext_offset, + unsigned long *gpt_offset, int *gpt_count, + int *gpt_size, char *buf) { /* Forward declarations. */ auto int next_bsd_partition (void); auto int next_solaris_partition(void); auto int next_pc_slice (void); + auto int next_gpt_slice(void); /* Get next BSD partition in current PC slice. */ int next_bsd_partition (void) @@ -729,6 +740,40 @@ next_partition (unsigned long drive, unsigned long dest, return 0; } + /* If this is a GPT partition table, read it as such. */ + if (*entry == -1 && *offset == 0 && PC_SLICE_TYPE (buf, 0) == PC_SLICE_TYPE_GPT) + { + struct grub_gpt_header *hdr = (struct grub_gpt_header *) buf; + + /* Read in the GPT Partition table header. */ + if (! rawread (drive, 1, 0, SECTOR_SIZE, buf)) + return 0; + + if (hdr->magic == GPT_HEADER_MAGIC && hdr->version == 0x10000) + { + /* Let gpt_offset point to the first entry in the GPT + partition table. This can also be used by callers of + next_partition to determine if a entry comes from a + GPT partition table or not. */ + *gpt_offset = hdr->partitions; + *gpt_count = hdr->maxpart; + *gpt_size = hdr->partentry_size; + + return next_gpt_slice(); + } + else + { + /* This is not a valid header for a GPT partition table. + Re-read the MBR or the boot sector of the extended + partition. */ + if (! rawread (drive, *offset, 0, SECTOR_SIZE, buf)) + return 0; + } + } + + /* Not a GPT partition. */ + *gpt_offset = 0; + /* Increase the entry number. */ (*entry)++; @@ -773,6 +818,43 @@ next_partition (unsigned long drive, unsigned long dest, return 1; } + /* Get the next GPT slice. */ + int next_gpt_slice (void) + { + struct grub_gpt_partentry *gptentry = (struct grub_gpt_partentry *) buf; + /* Make GPT partitions show up as PC slices. */ + int pc_slice_no = (*partition & 0xFF0000) >> 16; + + /* If this is the first time... */ + if (pc_slice_no == 0xFF) + { + pc_slice_no = -1; + *entry = -1; + } + + do { + (*entry)++; + + if (*entry >= *gpt_count) + { + errnum = ERR_NO_PART; + return 0; + } + /* Read in the GPT Partition table entry. */ + if (! rawread (drive, (*gpt_offset) + GPT_ENTRY_SECTOR (*gpt_size, *entry), GPT_ENTRY_INDEX (*gpt_size, *entry), *gpt_size, buf)) + return 0; + } while (! (gptentry->type1 && gptentry->type2)); + + pc_slice_no++; + *start = gptentry->start; + *len = gptentry->end - gptentry->start + 1; + *type = PC_SLICE_TYPE_EXT2FS; + *entry = pc_slice_no; + *partition = (*entry << 16) | 0xFFFF; + + return 1; + } + /* Start the body of this function. */ #ifndef STAGE1_5 @@ -788,6 +870,9 @@ next_partition (unsigned long drive, unsigned long dest, errnum = ERR_NONE; } + if (*partition != 0xFFFFFF && *gpt_offset != 0) + return next_gpt_slice (); + /* If previous partition is a BSD partition or a PC slice which contains BSD partitions... */ if ((*partition != 0xFFFFFF && IS_PC_SLICE_TYPE_BSD (*type & 0xff)) @@ -826,6 +911,9 @@ real_open_partition (int flags) unsigned long dest_partition = current_partition; unsigned long part_offset; unsigned long ext_offset; + unsigned long gpt_offset; + int gpt_count; + int gpt_size; int entry; char buf[SECTOR_SIZE]; int unix_part, pc_slice; @@ -837,7 +925,8 @@ real_open_partition (int flags) int ret = next_partition (current_drive, dest_partition, ¤t_partition, ¤t_slice, &part_start, &part_length, - &part_offset, &entry, &ext_offset, buf); + &part_offset, &entry, &ext_offset, + &gpt_offset, &gpt_count, &gpt_size, buf); unix_part = (current_partition >> 8) & 0xFF; pc_slice = current_partition >> 16; return ret; diff --git a/usr/src/grub/grub-0.97/stage2/gpt.h b/usr/src/grub/grub-0.97/stage2/gpt.h new file mode 100644 index 0000000000..71ed0b843b --- /dev/null +++ b/usr/src/grub/grub-0.97/stage2/gpt.h @@ -0,0 +1,68 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002,2005,2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _GPT_H +#define _GPT_H + +typedef signed char grub_int8_t; +typedef signed short grub_int16_t; +typedef signed int grub_int32_t; +typedef signed long long int grub_int64_t; +typedef unsigned char grub_uint8_t; +typedef unsigned short grub_uint16_t; +typedef unsigned int grub_uint32_t; +typedef unsigned long long int grub_uint64_t; + +struct grub_gpt_header +{ + grub_uint64_t magic; + grub_uint32_t version; + grub_uint32_t headersize; + grub_uint32_t crc32; + grub_uint32_t unused1; + grub_uint64_t primary; + grub_uint64_t backup; + grub_uint64_t start; + grub_uint64_t end; + grub_uint8_t guid[16]; + grub_uint64_t partitions; + grub_uint32_t maxpart; + grub_uint32_t partentry_size; + grub_uint32_t partentry_crc32; +} __attribute__ ((packed)); + +struct grub_gpt_partentry +{ + grub_uint64_t type1; + grub_uint64_t type2; + grub_uint8_t guid[16]; + grub_uint64_t start; + grub_uint64_t end; + grub_uint8_t attrib; + char name[72]; +} __attribute__ ((packed)); + +#define GPT_HEADER_MAGIC 0x5452415020494645ULL + +#define GPT_ENTRY_SECTOR(size,entry) \ + ((((entry) * (size) + 1) & ~(SECTOR_SIZE - 1)) >> SECTOR_BITS) +#define GPT_ENTRY_INDEX(size,entry) \ + ((((entry) * (size) + 1) & (SECTOR_SIZE - 1)) - 1) + +#endif /* _GPT_H */ diff --git a/usr/src/grub/grub-0.97/stage2/pc_slice.h b/usr/src/grub/grub-0.97/stage2/pc_slice.h index a237f88a26..7e7171d5c4 100644 --- a/usr/src/grub/grub-0.97/stage2/pc_slice.h +++ b/usr/src/grub/grub-0.97/stage2/pc_slice.h @@ -118,6 +118,7 @@ #define PC_SLICE_TYPE_SOLARIS_BOOT 0xbe /* Solaris boot (fat) */ #define PC_SLICE_TYPE_SOLARIS2 0xbf /* new Solaris type */ #define PC_SLICE_TYPE_DELL_UTIL 0xde +#define PC_SLICE_TYPE_GPT 0xee #define PC_SLICE_TYPE_LINUX_RAID 0xfd diff --git a/usr/src/grub/grub-0.97/stage2/shared.h b/usr/src/grub/grub-0.97/stage2/shared.h index cb41978ce3..9cf436e346 100644 --- a/usr/src/grub/grub-0.97/stage2/shared.h +++ b/usr/src/grub/grub-0.97/stage2/shared.h @@ -1021,7 +1021,9 @@ int next_partition (unsigned long drive, unsigned long dest, unsigned long *partition, int *type, unsigned long *start, unsigned long *len, unsigned long *offset, int *entry, - unsigned long *ext_offset, char *buf); + unsigned long *ext_offset, + unsigned long *gpt_offset, int *gpt_count, + int *gpt_size, char *buf); /* Sets device to the one represented by the SAVED_* parameters. */ int make_saved_active (void); diff --git a/usr/src/lib/gss_mechs/mech_krb5/Makefile.com b/usr/src/lib/gss_mechs/mech_krb5/Makefile.com index 3d41bd6a10..0d437868bf 100644 --- a/usr/src/lib/gss_mechs/mech_krb5/Makefile.com +++ b/usr/src/lib/gss_mechs/mech_krb5/Makefile.com @@ -152,7 +152,7 @@ K5_OS= an_to_ln.o def_realm.o ccdefname.o free_krbhs.o free_hstrl.o \ K5_OS_UTS=init_os_ctx.o timeofday.o toffset.o c_ustime.o -K5_POSIX= setenv.o daemon.o +K5_POSIX= setenv.o K5_RCACHE=rc_base.o rc_file.o rc_mem.o rc_common.o rc_io.o rcdef.o rc_conv.o \ ser_rc.o rcfns.o rc_none.o diff --git a/usr/src/lib/gss_mechs/mech_krb5/krb5/posix/daemon.c b/usr/src/lib/gss_mechs/mech_krb5/krb5/posix/daemon.c deleted file mode 100644 index 00dde4882e..0000000000 --- a/usr/src/lib/gss_mechs/mech_krb5/krb5/posix/daemon.c +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "k5-int.h" -#include <fcntl.h> -#include <sys/types.h> -#include <sys/file.h> -#include <unistd.h> -#ifdef HAVE_PATHS_H -#include <paths.h> -#endif - -#ifndef _PATH_DEVNULL -#define _PATH_DEVNULL "/dev/null" -#endif - -int -daemon(nochdir, noclose) - int nochdir, noclose; -{ - int cpid; - - if ((cpid = fork()) == -1) - return (-1); - if (cpid) - exit(0); -#ifdef HAVE_SETSID - (void) setsid(); -#else -#ifndef TIOCNOTTY - setpgrp(); -#else - { - int n; - - /* - * The open below may hang on pseudo ttys if the person - * who starts named logs out before this point. Thus, - * the need for the timer. - */ - alarm(120); - n = open("/dev/tty", O_RDWR); - alarm(0); - if (n > 0) { - (void) ioctl(n, TIOCNOTTY, (char *)NULL); - (void) close(n); - } - } -#endif -#endif - if (!nochdir) - (void) chdir("/"); - if (!noclose) { - int devnull = open(_PATH_DEVNULL, O_RDWR, 0); - - if (devnull != -1) { - (void) dup2(devnull, 0); - (void) dup2(devnull, 1); - (void) dup2(devnull, 2); - if (devnull > 2) - (void) close(devnull); - } - } - return (0); -} diff --git a/usr/src/lib/gss_mechs/mech_krb5/mapfile-vers b/usr/src/lib/gss_mechs/mech_krb5/mapfile-vers index 50b3e46887..bbe2bf414d 100644 --- a/usr/src/lib/gss_mechs/mech_krb5/mapfile-vers +++ b/usr/src/lib/gss_mechs/mech_krb5/mapfile-vers @@ -144,7 +144,6 @@ SYMBOL_VERSION SUNWprivate_1.1 { asn1buf_wrap_data; com_err; com_err_va; - daemon; decode_krb5_alt_method; decode_krb5_ap_rep; decode_krb5_ap_rep_enc_part; diff --git a/usr/src/lib/libbe/Makefile.com b/usr/src/lib/libbe/Makefile.com index b71a0f85b5..bc04dd8a47 100644 --- a/usr/src/lib/libbe/Makefile.com +++ b/usr/src/lib/libbe/Makefile.com @@ -22,8 +22,8 @@ # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # -# Copyright 2011 Nexenta Systems, Inc. All rights reserved. # Copyright 2012 OmniTI Computer Consulting, Inc. All rights reserved. +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. # @@ -50,7 +50,7 @@ INCS += -I$(SRCDIR) C99MODE= $(C99_ENABLE) -LDLIBS += -lzfs -linstzones -luuid -lnvpair -lc -lgen -ldevinfo +LDLIBS += -lzfs -linstzones -luuid -lnvpair -lc -lgen -ldevinfo -lefi CPPFLAGS += $(INCS) CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized diff --git a/usr/src/lib/libbe/common/be_activate.c b/usr/src/lib/libbe/common/be_activate.c index 5b4555d924..da6ed3fb18 100644 --- a/usr/src/lib/libbe/common/be_activate.c +++ b/usr/src/lib/libbe/common/be_activate.c @@ -24,7 +24,7 @@ */ /* - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ #include <assert.h> @@ -34,11 +34,14 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <strings.h> #include <errno.h> #include <sys/mnttab.h> #include <sys/types.h> #include <sys/stat.h> +#include <fcntl.h> #include <unistd.h> +#include <sys/efi_partition.h> #include <libbe.h> #include <libbe_priv.h> @@ -50,6 +53,9 @@ char *mnttab = MNTTAB; */ static int set_bootfs(char *boot_rpool, char *be_root_ds); static int set_canmount(be_node_list_t *, char *); +static boolean_t be_do_installgrub_mbr(char *, nvlist_t *); +static int be_do_installgrub_helper(zpool_handle_t *, nvlist_t *, char *, + char *); static int be_do_installgrub(be_transaction_data_t *); static int be_get_grub_vers(be_transaction_data_t *, char **, char **); static int get_ver_from_capfile(char *, char **); @@ -750,6 +756,136 @@ get_ver_from_capfile(char *file, char **vers) } /* + * To be able to boot EFI labeled disks, GRUB stage1 needs to be written + * into the MBR. We do not do this if we're on disks with a traditional + * fdisk partition table only, or if any foreign EFI partitions exist. + * In the trivial case of a whole-disk vdev we always write stage1 into + * the MBR. + */ +static boolean_t +be_do_installgrub_mbr(char *diskname, nvlist_t *child) +{ + struct uuid allowed_uuids[] = { + EFI_UNUSED, + EFI_RESV1, + EFI_BOOT, + EFI_ROOT, + EFI_SWAP, + EFI_USR, + EFI_BACKUP, + EFI_RESV2, + EFI_VAR, + EFI_HOME, + EFI_ALTSCTR, + EFI_RESERVED, + EFI_SYSTEM, + EFI_BIOS_BOOT, + EFI_SYMC_PUB, + EFI_SYMC_CDS + }; + + uint64_t whole; + struct dk_gpt *gpt; + struct uuid *u; + int fd, npart, i, j; + + (void) nvlist_lookup_uint64(child, ZPOOL_CONFIG_WHOLE_DISK, + &whole); + + if (whole) + return (B_TRUE); + + if ((fd = open(diskname, O_RDONLY|O_NDELAY)) < 0) + return (B_FALSE); + + if ((npart = efi_alloc_and_read(fd, &gpt)) <= 0) + return (B_FALSE); + + for (i = 0; i != npart; i++) { + int match = 0; + + u = &gpt->efi_parts[i].p_guid; + + for (j = 0; + j != sizeof (allowed_uuids) / sizeof (struct uuid); + j++) + if (bcmp(u, &allowed_uuids[j], + sizeof (struct uuid)) == 0) + match++; + + if (match == 0) + return (B_FALSE); + } + + return (B_TRUE); +} + +static int +be_do_installgrub_helper(zpool_handle_t *zphp, nvlist_t *child, char *stage1, + char *stage2) +{ + char installgrub_cmd[MAXPATHLEN]; + char be_run_cmd_errbuf[BUFSIZ]; + char diskname[MAXPATHLEN]; + char *vname; + char *path, *dsk_ptr; + char *m_flag = ""; + + if (nvlist_lookup_string(child, ZPOOL_CONFIG_PATH, &path) != 0) { + be_print_err(gettext("be_do_installgrub: " + "failed to get device path\n")); + return (BE_ERR_NODEV); + } + + /* + * Modify the vdev path to point to the raw disk. + */ + path = strdup(path); + if (path == NULL) + return (BE_ERR_NOMEM); + + dsk_ptr = strstr(path, "/dsk/"); + if (dsk_ptr != NULL) { + *dsk_ptr = '\0'; + dsk_ptr++; + } else { + dsk_ptr = ""; + } + + (void) snprintf(diskname, sizeof (diskname), "%s/r%s", path, dsk_ptr); + free(path); + + if (be_do_installgrub_mbr(diskname, child)) + m_flag = "-m -f"; + + vname = zpool_vdev_name(g_zfs, zphp, child, B_FALSE); + if (vname == NULL) { + be_print_err(gettext("be_do_installgrub: " + "failed to get device name: %s\n"), + libzfs_error_description(g_zfs)); + return (zfs_err_to_be_err(g_zfs)); + } + + (void) snprintf(installgrub_cmd, sizeof (installgrub_cmd), + "%s %s %s %s %s", BE_INSTALL_GRUB, m_flag, stage1, stage2, + diskname); + if (be_run_cmd(installgrub_cmd, be_run_cmd_errbuf, BUFSIZ, NULL, 0) + != BE_SUCCESS) { + be_print_err(gettext("be_do_installgrub: installgrub " + "failed for device %s.\n"), vname); + /* Assume localized cmd err output. */ + be_print_err(gettext(" Command: \"%s\"\n"), + installgrub_cmd); + be_print_err("%s", be_run_cmd_errbuf); + free(vname); + return (BE_ERR_BOOTFILE_INST); + } + free(vname); + + return (BE_SUCCESS); +} + +/* * Function: be_do_installgrub * Description: This function runs installgrub using the grub loader files * from the BE we're activating and installing them on the @@ -782,9 +918,7 @@ be_do_installgrub(be_transaction_data_t *bt) char zpool_cap_file[MAXPATHLEN]; char stage1[MAXPATHLEN]; char stage2[MAXPATHLEN]; - char installgrub_cmd[MAXPATHLEN]; char *vname; - char be_run_cmd_errbuf[BUFSIZ]; int ret = BE_SUCCESS; int err = 0; boolean_t be_mounted = B_FALSE; @@ -868,6 +1002,7 @@ be_do_installgrub(be_transaction_data_t *bt) goto done; } if (strcmp(vname, "mirror") == 0 || vname[0] != 'c') { + free(vname); if (nvlist_lookup_nvlist_array(child[c], ZPOOL_CONFIG_CHILDREN, &nvchild, &nchildren) != 0) { @@ -879,56 +1014,18 @@ be_do_installgrub(be_transaction_data_t *bt) } for (i = 0; i < nchildren; i++) { - vname = zpool_vdev_name(g_zfs, zphp, - nvchild[i], B_FALSE); - if (vname == NULL) { - be_print_err(gettext( - "be_do_installgrub: " - "failed to get device name: %s\n"), - libzfs_error_description(g_zfs)); - ret = zfs_err_to_be_err(g_zfs); + ret = be_do_installgrub_helper(zphp, nvchild[i], + stage1, stage2); + if (ret != BE_SUCCESS) goto done; - } - - (void) snprintf(installgrub_cmd, - sizeof (installgrub_cmd), - "%s %s %s /dev/rdsk/%s", - BE_INSTALL_GRUB, stage1, stage2, vname); - if (be_run_cmd(installgrub_cmd, - be_run_cmd_errbuf, BUFSIZ, NULL, 0) != - BE_SUCCESS) { - be_print_err(gettext( - "be_do_installgrub: installgrub " - "failed for device %s.\n"), vname); - /* Assume localized cmd err output. */ - be_print_err(gettext( - " Command: \"%s\"\n"), - installgrub_cmd); - be_print_err("%s", be_run_cmd_errbuf); - free(vname); - ret = BE_ERR_BOOTFILE_INST; - goto done; - } - free(vname); } } else { - (void) snprintf(installgrub_cmd, - sizeof (installgrub_cmd), "%s %s %s /dev/rdsk/%s", - BE_INSTALL_GRUB, stage1, stage2, vname); - if (be_run_cmd(installgrub_cmd, be_run_cmd_errbuf, - BUFSIZ, NULL, 0) != BE_SUCCESS) { - be_print_err(gettext( - "be_do_installgrub: installgrub " - "failed for device %s.\n"), vname); - /* Assume localized cmd err output. */ - be_print_err(gettext(" Command: \"%s\"\n"), - installgrub_cmd); - be_print_err("%s", be_run_cmd_errbuf); - free(vname); - ret = BE_ERR_BOOTFILE_INST; - goto done; - } free(vname); + + ret = be_do_installgrub_helper(zphp, child[c], stage1, + stage2); + if (ret != BE_SUCCESS) + goto done; } } diff --git a/usr/src/lib/libgrubmgmt/common/libgrub_cmd.c b/usr/src/lib/libgrubmgmt/common/libgrub_cmd.c index 85304d45e7..5dc12247b1 100644 --- a/usr/src/lib/libgrubmgmt/common/libgrub_cmd.c +++ b/usr/src/lib/libgrubmgmt/common/libgrub_cmd.c @@ -22,6 +22,9 @@ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2015 Nexenta Systems, Inc. + */ /* * This file contains all the functions that implement the following @@ -399,7 +402,7 @@ findroot(const grub_line_t *lp, grub_barg_t *barg) return (EG_FINDROOTFMT); ++pos; - if (pos[0] != ',' || + if ((pos[0] != ',' && pos[0] != ')') || !IS_SLCNUM_VALID(barg->gb_slcnum = pos[1]) || pos[2] != ')') return (EG_FINDROOTFMT); diff --git a/usr/src/lib/libresolv2/Makefile.com b/usr/src/lib/libresolv2/Makefile.com index c02ae222a1..942d2a69b8 100644 --- a/usr/src/lib/libresolv2/Makefile.com +++ b/usr/src/lib/libresolv2/Makefile.com @@ -27,7 +27,7 @@ LIBRARY= libresolv.a VERS= .2 -BSDOBJS= daemon.o putenv.o strcasecmp.o strsep.o \ +BSDOBJS= putenv.o strcasecmp.o strsep.o \ ftruncate.o readv.o strdup.o strtoul.o \ gettimeofday.o setenv.o strerror.o utimes.o \ mktemp.o setitimer.o strpbrk.o writev.o diff --git a/usr/src/lib/libresolv2/common/bsd/daemon.c b/usr/src/lib/libresolv2/common/bsd/daemon.c deleted file mode 100644 index 54ff83b753..0000000000 --- a/usr/src/lib/libresolv2/common/bsd/daemon.c +++ /dev/null @@ -1,81 +0,0 @@ -#if defined(LIBC_SCCS) && !defined(lint) -static const char sccsid[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: daemon.c,v 1.2 2005/04/27 04:56:10 sra Exp $"; -#endif /* LIBC_SCCS and not lint */ - -/* - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "port_before.h" - -#include <fcntl.h> -#include <paths.h> -#include <unistd.h> - -#include "port_after.h" - -#ifndef NEED_DAEMON -int __bind_daemon__; -#else - -int -daemon(int nochdir, int noclose) { - int fd; - - switch (fork()) { - case -1: - return (-1); - case 0: - break; - default: - _exit(0); - } - - if (setsid() == -1) - return (-1); - - if (!nochdir) - (void)chdir("/"); - - if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { - (void)dup2(fd, STDIN_FILENO); - (void)dup2(fd, STDOUT_FILENO); - (void)dup2(fd, STDERR_FILENO); - if (fd > 2) - (void)close (fd); - } - return (0); -} -#endif - -/*! \file */ diff --git a/usr/src/lib/libresolv2/common/mapfile-vers b/usr/src/lib/libresolv2/common/mapfile-vers index a70aac2380..cd2b90ad2c 100644 --- a/usr/src/lib/libresolv2/common/mapfile-vers +++ b/usr/src/lib/libresolv2/common/mapfile-vers @@ -130,7 +130,6 @@ SYMBOL_VERSION SUNWprivate_2.1 { __ctl_sendhelp; __ctl_server; __ctl_setcsctx; - daemon; dn_count_labels; __dn_count_labels; dn_skipname; diff --git a/usr/src/lib/libresolv2/include/port_after.h b/usr/src/lib/libresolv2/include/port_after.h index c3abf4b334..a88b8a59ce 100644 --- a/usr/src/lib/libresolv2/include/port_after.h +++ b/usr/src/lib/libresolv2/include/port_after.h @@ -46,7 +46,6 @@ #undef NEED_PSELECT #undef HAVE_SA_LEN #undef HAVE_MINIMUM_IFREQ -#define NEED_DAEMON 1 #undef NEED_STRSEP #undef NEED_STRERROR #ifdef NEED_STRERROR @@ -292,10 +291,6 @@ extern const struct in6_addr isc_in6addr_loopback; #define MAX(x,y) (((x) >= (y)) ? (x) : (y)) #endif -#ifdef NEED_DAEMON -int daemon(int nochdir, int noclose); -#endif - #ifdef NEED_STRSEP char * strsep(char **stringp, const char *delim); #endif diff --git a/usr/src/lib/libsocket/common/mapfile-vers b/usr/src/lib/libsocket/common/mapfile-vers index 2f7777f395..471774b462 100644 --- a/usr/src/lib/libsocket/common/mapfile-vers +++ b/usr/src/lib/libsocket/common/mapfile-vers @@ -39,6 +39,12 @@ $mapfile_version 2 +SYMBOL_VERSION ILLUMOS_0.2 { # reentrant ethers(3SOCKET) + global: + ether_aton_r; + ether_ntoa_r; +} ILLUMOS_0.1; + SYMBOL_VERSION ILLUMOS_0.1 { # Illumos additions global: accept4; diff --git a/usr/src/lib/libsocket/inet/ether_addr.c b/usr/src/lib/libsocket/inet/ether_addr.c index 37105bb302..523e7b472d 100644 --- a/usr/src/lib/libsocket/inet/ether_addr.c +++ b/usr/src/lib/libsocket/inet/ether_addr.c @@ -22,6 +22,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright (c) 2014, Joyent, Inc. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -37,8 +38,6 @@ * contributors. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * All routines necessary to deal the "ethers" database. The sources * contain mappings between 48 bit ethernet addresses and corresponding @@ -258,38 +257,42 @@ ea_buf(void) } /* - * Converts a 48 bit ethernet number to its string representation. + * Converts a 48 bit ethernet number to its string representation using a user + * defined buffer. + */ +char * +ether_ntoa_r(const struct ether_addr *e, char *buf) +{ + (void) sprintf(buf, "%x:%x:%x:%x:%x:%x", + e->ether_addr_octet[0], e->ether_addr_octet[1], + e->ether_addr_octet[2], e->ether_addr_octet[3], + e->ether_addr_octet[4], e->ether_addr_octet[5]); + return (buf); +} + +/* + * Converts a 48 bit ethernet number to its string representation using a + * per-thread buffer. */ char * ether_ntoa(const struct ether_addr *e) { eabuf_t *eabuf; - char *s; if ((eabuf = ea_buf()) == NULL) return (NULL); - s = eabuf->ea_string; - (void) sprintf(s, "%x:%x:%x:%x:%x:%x", - e->ether_addr_octet[0], e->ether_addr_octet[1], - e->ether_addr_octet[2], e->ether_addr_octet[3], - e->ether_addr_octet[4], e->ether_addr_octet[5]); - return (s); + return (ether_ntoa_r(e, eabuf->ea_string)); } /* - * Converts an ethernet address representation back into its 48 bits. + * Converts an ethernet address representation back into its 48 bits using a + * user defined buffer. */ struct ether_addr * -ether_aton(const char *s) +ether_aton_r(const char *s, struct ether_addr *e) { - eabuf_t *eabuf; - struct ether_addr *e; int i; uint_t t[6]; - - if ((eabuf = ea_buf()) == NULL) - return (NULL); - e = &eabuf->ea_addr; i = sscanf(s, " %x:%x:%x:%x:%x:%x", &t[0], &t[1], &t[2], &t[3], &t[4], &t[5]); if (i != 6) @@ -298,3 +301,17 @@ ether_aton(const char *s) e->ether_addr_octet[i] = (uchar_t)t[i]; return (e); } + +/* + * Converts an ethernet address representation back into its 48 bits using a + * per-thread buffer. + */ +struct ether_addr * +ether_aton(const char *s) +{ + eabuf_t *eabuf; + + if ((eabuf = ea_buf()) == NULL) + return (NULL); + return (ether_aton_r(s, &eabuf->ea_addr)); +} diff --git a/usr/src/lib/libzfs/common/libzfs_pool.c b/usr/src/lib/libzfs/common/libzfs_pool.c index 85230ecc65..0c37c36257 100644 --- a/usr/src/lib/libzfs/common/libzfs_pool.c +++ b/usr/src/lib/libzfs/common/libzfs_pool.c @@ -380,27 +380,6 @@ bootfs_name_valid(const char *pool, char *bootfs) return (B_FALSE); } -/* - * Inspect the configuration to determine if any of the devices contain - * an EFI label. - */ -static boolean_t -pool_uses_efi(nvlist_t *config) -{ - nvlist_t **child; - uint_t c, children; - - if (nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_CHILDREN, - &child, &children) != 0) - return (read_efi_label(config, NULL) >= 0); - - for (c = 0; c < children; c++) { - if (pool_uses_efi(child[c])) - return (B_TRUE); - } - return (B_FALSE); -} - boolean_t zpool_is_bootable(zpool_handle_t *zhp) { @@ -429,7 +408,6 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname, char *slash, *check; struct stat64 statbuf; zpool_handle_t *zhp; - nvlist_t *nvroot; if (nvlist_alloc(&retprops, NV_UNIQUE_NAME, 0) != 0) { (void) no_memory(hdl); @@ -548,21 +526,6 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname, (void) zfs_error(hdl, EZFS_OPENFAILED, errbuf); goto error; } - verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL), - ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); - - /* - * bootfs property cannot be set on a disk which has - * been EFI labeled. - */ - if (pool_uses_efi(nvroot)) { - zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "property '%s' not supported on " - "EFI labeled devices"), propname); - (void) zfs_error(hdl, EZFS_POOL_NOTSUP, errbuf); - zpool_close(zhp); - goto error; - } zpool_close(zhp); break; @@ -1285,25 +1248,6 @@ zpool_add(zpool_handle_t *zhp, nvlist_t *nvroot) return (zfs_error(hdl, EZFS_BADVERSION, msg)); } - if (zpool_is_bootable(zhp) && nvlist_lookup_nvlist_array(nvroot, - ZPOOL_CONFIG_SPARES, &spares, &nspares) == 0) { - uint64_t s; - - for (s = 0; s < nspares; s++) { - char *path; - - if (nvlist_lookup_string(spares[s], ZPOOL_CONFIG_PATH, - &path) == 0 && pool_uses_efi(spares[s])) { - zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "device '%s' contains an EFI label and " - "cannot be used on root pools."), - zpool_vdev_name(hdl, NULL, spares[s], - B_FALSE)); - return (zfs_error(hdl, EZFS_POOL_NOTSUP, msg)); - } - } - } - if (zpool_get_prop_int(zhp, ZPOOL_PROP_VERSION, NULL) < SPA_VERSION_L2CACHE && nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_L2CACHE, @@ -2318,11 +2262,9 @@ zpool_get_config_physpath(nvlist_t *config, char *physpath, size_t phypath_size) return (EZFS_INVALCONFIG); /* - * root pool can not have EFI labeled disks and can only have - * a single top-level vdev. + * root pool can only have a single top-level vdev. */ - if (strcmp(type, VDEV_TYPE_ROOT) != 0 || count != 1 || - pool_uses_efi(vdev_root)) + if (strcmp(type, VDEV_TYPE_ROOT) != 0 || count != 1) return (EZFS_POOL_INVALARG); (void) vdev_get_physpaths(child[0], physpath, phypath_size, &rsz, @@ -2624,16 +2566,6 @@ zpool_vdev_attach(zpool_handle_t *zhp, (void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN, "cannot attach %s to %s"), new_disk, old_disk); - /* - * If this is a root pool, make sure that we're not attaching an - * EFI labeled device. - */ - if (rootpool && pool_uses_efi(nvroot)) { - zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "EFI labeled devices are not supported on root pools.")); - return (zfs_error(hdl, EZFS_POOL_NOTSUP, msg)); - } - (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); if ((tgt = zpool_find_vdev(zhp, old_disk, &avail_spare, &l2cache, &islog)) == 0) @@ -3909,13 +3841,6 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, char *name) if (zhp) { nvlist_t *nvroot; - if (zpool_is_bootable(zhp)) { - zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "EFI labeled devices are not supported on root " - "pools.")); - return (zfs_error(hdl, EZFS_POOL_NOTSUP, errbuf)); - } - verify(nvlist_lookup_nvlist(zhp->zpool_config, ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); diff --git a/usr/src/lib/print/mod_ipp/Makefile b/usr/src/lib/print/mod_ipp/Makefile index 137e88bbf8..395c75e0e3 100644 --- a/usr/src/lib/print/mod_ipp/Makefile +++ b/usr/src/lib/print/mod_ipp/Makefile @@ -22,6 +22,8 @@ # Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# LIBRARY = mod_ipp.a VERS = @@ -30,13 +32,22 @@ OBJECTS = mod_ipp.o include ../../Makefile.lib include ../../Makefile.rootfs -APACHEMODDIR = $(ROOT)/usr/apache/libexec -APACHECONFDIR = $(ROOT)/etc/apache +# These *BASE paths are used ONLY at build time to locate headers. +# This builds against Apache 2.2 but the module should work with +# any Apache 2.x version +APACHEBASE = /usr/apache2/2.2 +APR_BASE = /usr/apr +APRUBASE = /usr/apr-util + +IPPCONFDIR = $(ROOT)/etc/lp/ipp +IPPLIBDIR = $(ROOT)/usr/lib/lp/ipp LISTENERDIR = $(ROOT)/var/lp/ipp-listener -ROOTDIRS = $(ROOT)/usr/apache $(APACHEMODDIR) $(APACHECONFDIR) \ +ROOTDIRS = $(ROOT)/etc/lp $(IPPCONFDIR) \ + $(ROOT)/usr/lib/lp $(IPPLIBDIR) \ $(ROOT)/var/lp $(LISTENERDIR) +$(ROOT)/etc/lp:= DIRMODE = 775 $(ROOT)/var/lp:= DIRMODE = 775 $(ROOT)/var/lp:= FILEMODE = 775 @@ -48,11 +59,17 @@ SRCS = $(OBJECTS:%.o = %.c) CFLAGS += $(CCVERBOSE) CPPFLAGS += -I../libipp-listener/common CPPFLAGS += -I../libipp-core/common -CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/apache/include +CPPFLAGS += -I$(ADJUNCT_PROTO)$(APACHEBASE)/include +CPPFLAGS += -I$(ADJUNCT_PROTO)$(APR_BASE)/include +CPPFLAGS += -I$(ADJUNCT_PROTO)$(APRUBASE)/include +CPPFLAGS += -DAPACHE2 CPPFLAGS += -DEAPI -ZDEFS = $(ZNODEFS) -MAPFILES = mapfile +# See: /usr/apache2/2.2/build/config_vars.mk +# Make sure to build with compatible flags. +CPPFLAGS += -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + +MAPFILES = mapfile httpd-syms.map LDLIBS += -lipp-listener -lipp-core -lpapi -lc @@ -63,19 +80,20 @@ ROOTMANIFEST= $(MANIFEST:%=$(ROOTMANIFESTDIR)/%) $(ROOTMANIFEST) := FILEMODE= 444 # Apache module -$(APACHEMODDIR)/$(LIBLINKS): $(ROOTDIRS) +# LIBLINKS is not a link here, just the bare *.so name +$(IPPLIBDIR)/$(LIBLINKS): $(ROOTDIRS) # Apache config -APACHECONFFILE= $(APACHECONFDIR)/httpd-standalone-ipp.conf +APACHECONFFILE= $(IPPCONFDIR)/httpd-standalone-ipp.conf $(APACHECONFFILE) := FILEMODE= 644 LISTENERFILE= $(LISTENERDIR)/index.html $(LISTENERFILE) := FILEMODE= 444 $(ROOT)/var/lp:= FILEMODE = 0775 -$(APACHEMODDIR)/$(LIBLINKS):= FILEMODE = 0555 +$(IPPLIBDIR)/$(LIBLINKS):= FILEMODE = 0555 -$(ROOTMANIFESTDIR)/% $(APACHEMODDIR)/% $(APACHECONFDIR)/% $(LISTENERDIR)/%: % +$(ROOTMANIFESTDIR)/% $(IPPLIBDIR)/% $(IPPCONFDIR)/% $(LISTENERDIR)/%: % $(INS.file) $(ROOTDIRS): @@ -85,7 +103,7 @@ $(ROOTDIRS): all: $(LIBS) -install: all $(APACHEMODDIR)/$(LIBLINKS) $(APACHECONFFILE) \ +install: all $(IPPLIBDIR)/$(LIBLINKS) $(APACHECONFFILE) \ $(LISTENERFILE) $(ROOTMANIFEST) install_h: diff --git a/usr/src/lib/print/mod_ipp/httpd-standalone-ipp.conf b/usr/src/lib/print/mod_ipp/httpd-standalone-ipp.conf index 07a4b8dc11..419f23fb93 100644 --- a/usr/src/lib/print/mod_ipp/httpd-standalone-ipp.conf +++ b/usr/src/lib/print/mod_ipp/httpd-standalone-ipp.conf @@ -28,8 +28,6 @@ # "$Id: httpd-standalone-ipp.conf,v 1.4 2006/03/24 00:26:54 njacobs Exp $" # -# ident "%Z%%M% %I% %E% SMI" - ## ## httpd-standalone-ipp.conf -- Apache HTTP server configuration file for ## an Internet Print Protocol (IPP) listener @@ -53,12 +51,6 @@ # # -# ServerType is either inetd, or standalone. Inetd mode is only supported on -# Unix platforms. -# -ServerType standalone - -# # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. # @@ -67,7 +59,8 @@ ServerType standalone # (available at <URL:http://www.apache.org/docs/mod/core.html#lockfile>); # you will save yourself a lot of trouble. # -ServerRoot "/usr/apache" +# Change /usr/apache2/... if Apache 2.x is elsewhere. +ServerRoot "/usr/apache2/2.2" # # The LockFile directive sets the path to the lockfile used when Apache @@ -192,24 +185,14 @@ MaxRequestsPerChild 10 # Note: The order in which modules are loaded is important. Don't change # the order below without expert advice. # -LoadModule access_module libexec/mod_access.so LoadModule alias_module libexec/mod_alias.so -LoadModule auth_module libexec/mod_auth.so +LoadModule auth_basic_module libexec/mod_auth_basic.so +LoadModule authn_file_module libexec/mod_authn_file.so +LoadModule authz_host_module libexec/mod_authz_host.so +LoadModule authz_user_module libexec/mod_authz_user.so LoadModule mime_module libexec/mod_mime.so LoadModule mime_magic_module libexec/mod_mime_magic.so -LoadModule ipp_module libexec/mod_ipp.so - -# Reconstruction of the complete module list from all available modules -# (static and shared ones) to achieve correct module execution order. -# [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO] -ClearModuleList -AddModule mod_access.c -AddModule mod_alias.c -AddModule mod_auth.c -AddModule mod_mime.c -AddModule mod_mime_magic.c -AddModule mod_ipp.c -AddModule mod_so.c +LoadModule ipp_module /usr/lib/lp/ipp/mod_ipp.so ### Section 2: 'Main' server configuration # @@ -234,11 +217,11 @@ AddModule mod_so.c # Port: The port to which the standalone server listens. For # ports < 1023, you will need httpd to be run as root initially. # -Port 631 +Listen 631 # # If you wish httpd to run as a different user or group, you must run -# httpd as root initially and it will switch. +# httpd as root initially and it will switch. # # User/Group: The name (or #number) of the user/group to run httpd as. # . On SCO (ODT 3) use "User nouser" and "Group nogroup". @@ -327,6 +310,8 @@ Alias /etc/lp/ppd/ /etc/lp/ppd/ # ipp-default-user nobody ipp-default-service lpsched + # To be more restrictive, use this intead: + # ipp-operation required on ipp-operation all on AuthType Basic @@ -338,4 +323,3 @@ Alias /etc/lp/ppd/ /etc/lp/ppd/ ErrorDocument 404 /index.html </Location> </IfModule> - diff --git a/usr/src/lib/print/mod_ipp/httpd-syms.map b/usr/src/lib/print/mod_ipp/httpd-syms.map new file mode 100644 index 0000000000..2a08f20538 --- /dev/null +++ b/usr/src/lib/print/mod_ipp/httpd-syms.map @@ -0,0 +1,43 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +# +# These are the symbols in Apache (httpd) that this module needs +# to bind with. By explicitly telling the linker these are external, +# we can detect any other binding problems at link time. +# + +$mapfile_version 2 + +SYMBOL_SCOPE { + core_module { TYPE = data; FLAGS = extern }; + + ap_discard_request_body { TYPE = function; FLAGS = extern }; + ap_get_client_block { TYPE = function; FLAGS = extern }; + ap_get_remote_host { TYPE = function; FLAGS = extern }; + ap_get_server_name { TYPE = function; FLAGS = extern }; + ap_get_server_port { TYPE = function; FLAGS = extern }; + ap_hook_default_port { TYPE = function; FLAGS = extern }; + ap_hook_handler { TYPE = function; FLAGS = extern }; + ap_hook_http_scheme { TYPE = function; FLAGS = extern }; + ap_log_rerror { TYPE = function; FLAGS = extern }; + ap_rwrite { TYPE = function; FLAGS = extern }; + ap_setup_client_block { TYPE = function; FLAGS = extern }; + ap_should_client_block { TYPE = function; FLAGS = extern }; + + apr_os_sock_get { TYPE = function; FLAGS = extern }; + apr_palloc { TYPE = function; FLAGS = extern }; + apr_table_get { TYPE = function; FLAGS = extern }; +}; diff --git a/usr/src/lib/print/mod_ipp/ipp-listener.xml b/usr/src/lib/print/mod_ipp/ipp-listener.xml index 686646a78c..9b4c15f17c 100644 --- a/usr/src/lib/print/mod_ipp/ipp-listener.xml +++ b/usr/src/lib/print/mod_ipp/ipp-listener.xml @@ -41,10 +41,11 @@ CDDL HEADER END <service_fmri value='svc:/application/print/server' /> </dependency> + <!-- Change /usr/apache2/... if Apache 2.x is elsewhere. --> <exec_method type='method' name='start' - exec='/usr/apache/bin/httpd -f /etc/apache/httpd-standalone-ipp.conf' + exec='/usr/apache2/2.2/bin/httpd -f /etc/lp/ipp/httpd-standalone-ipp.conf' timeout_seconds='10' /> <exec_method diff --git a/usr/src/lib/print/mod_ipp/mod_ipp.c b/usr/src/lib/print/mod_ipp/mod_ipp.c index 2d9ece2287..813b04723c 100644 --- a/usr/src/lib/print/mod_ipp/mod_ipp.c +++ b/usr/src/lib/print/mod_ipp/mod_ipp.c @@ -23,12 +23,11 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ /* $Id: mod_ipp.c 149 2006-04-25 16:55:01Z njacobs $ */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Internet Printing Protocol (IPP) module for Apache. */ @@ -36,6 +35,7 @@ #include "ap_config.h" #include <stdio.h> +#include <unistd.h> #include <time.h> #include <sys/time.h> #include <values.h> @@ -48,11 +48,12 @@ #include "http_protocol.h" #include "http_log.h" #include "http_main.h" -#include "papi.h" -#ifndef APACHE_RELEASE /* appears to only exist in Apache 1.X */ -#define APACHE2 +#ifndef APACHE2 #include "apr_compat.h" -#endif +#define apr_table_get ap_table_get +#endif /* APACHE2 */ + +#include "papi.h" #include <papi.h> #include <ipp-listener.h> @@ -123,7 +124,7 @@ read_data(void *fd, void *buf, size_t siz) #ifdef DEBUG fprintf(stderr, "read_data(0x%8.8x, 0x%8.8x, %d): %d", - fd, buf, siz, len_read); + fd, buf, siz, len_read); if (len_read < 0) fprintf(stderr, ": %s", strerror(errno)); putc('\n', stderr); @@ -194,7 +195,7 @@ void _log_rerror(const char *file, int line, int level, request_rec *r, va_end(args); #ifdef APACHE2 - ap_log_rerror(file, line, level, NULL, r, message); + ap_log_rerror(file, line, level, APR_SUCCESS, r, message); #else ap_log_rerror(file, line, level, r, message); #endif @@ -206,28 +207,26 @@ ipp_handler(request_rec *r) papi_attribute_t **request = NULL, **response = NULL; IPPListenerConfig *config; papi_status_t status; + const char *s; + int sockfd = -1; int ret; /* Really, IPP is all POST requests */ if (r->method_number != M_POST) return (DECLINED); -#ifndef APACHE2 /* * An IPP request must have a MIME type of "application/ipp" * (RFC-2910, Section 4, page 19). If it doesn't match this * MIME type, we should decline the request and let someone else * try and handle it. */ - if (r->headers_in != NULL) { - char *mime_type = (char *)ap_table_get(r->headers_in, - "Content-Type"); + if (r->headers_in == NULL) + return (DECLINED); + s = apr_table_get(r->headers_in, "Content-Type"); + if ((s == NULL) || (strcasecmp(s, "application/ipp") != 0)) + return (DECLINED); - if ((mime_type == NULL) || - (strcasecmp(mime_type, "application/ipp") != 0)) - return (DECLINED); - } -#endif /* CHUNKED_DECHUNK might not work right for IPP? */ if ((ret = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)) != OK) return (ret); @@ -243,49 +242,50 @@ ipp_handler(request_rec *r) if (status != PAPI_OK) _log_rerror(APLOG_MARK, APLOG_ERR, r, - "read failed: %s\n", papiStatusString(status)); + "read failed: %s\n", papiStatusString(status)); #ifdef DEBUG papiAttributeListPrint(stderr, request, "request (%d) ", getpid()); #endif - (void) papiAttributeListAddString(&request, PAPI_ATTR_EXCL, - "originating-host", (char *) #ifdef APACHE2 - ap_get_remote_host - (r->connection, r->per_dir_config, REMOTE_NAME, NULL)); + s = ap_get_remote_host(r->connection, r->per_dir_config, + REMOTE_NAME, NULL); #else - ap_get_remote_host - (r->connection, r->per_dir_config, REMOTE_NAME)); + s = ap_get_remote_host(r->connection, r->per_dir_config, + REMOTE_NAME); #endif + (void) papiAttributeListAddString(&request, PAPI_ATTR_EXCL, + "originating-host", (char *)s); (void) papiAttributeListAddInteger(&request, PAPI_ATTR_EXCL, - "uri-port", ap_get_server_port(r)); + "uri-port", ap_get_server_port(r)); + if (r->headers_in != NULL) { - char *host = (char *)ap_table_get(r->headers_in, "Host"); + char *host = (char *)apr_table_get(r->headers_in, "Host"); if ((host == NULL) || (host[0] == '\0')) host = (char *)ap_get_server_name(r); (void) papiAttributeListAddString(&request, PAPI_ATTR_EXCL, - "uri-host", host); + "uri-host", host); } (void) papiAttributeListAddString(&request, PAPI_ATTR_EXCL, - "uri-path", r->uri); + "uri-path", r->uri); config = ap_get_module_config(r->per_dir_config, &ipp_module); if (config != NULL) { (void) papiAttributeListAddInteger(&request, PAPI_ATTR_EXCL, - "conformance", config->conformance); + "conformance", config->conformance); (void) papiAttributeListAddCollection(&request, PAPI_ATTR_EXCL, - "operations", config->operations); + "operations", config->operations); if (config->default_user != NULL) (void) papiAttributeListAddString(&request, - PAPI_ATTR_EXCL, "default-user", - config->default_user); + PAPI_ATTR_EXCL, "default-user", + config->default_user); if (config->default_svc != NULL) (void) papiAttributeListAddString(&request, - PAPI_ATTR_EXCL, "default-service", - config->default_svc); + PAPI_ATTR_EXCL, "default-service", + config->default_svc); } /* @@ -294,15 +294,35 @@ ipp_handler(request_rec *r) * service to retrieve the sensativity label off of a multi-level * port. */ - (void) papiAttributeListAddInteger(&request, PAPI_ATTR_EXCL, - "peer-socket", ap_bfileno(r->connection->client, B_RD)); +#ifdef APACHE2 + /* + * In Apache 2.4 and later, could use: ap_get_conn_socket() + * Apache 2.2 uses ap_get_module_config() but that needs + * &core_module, for .module_index (which is just zero). + * Could either inline that with index zero, or declare + * core_module here. Latter seems less evil. + */ + { + extern module core_module; + apr_socket_t *csd = ap_get_module_config( + r->connection->conn_config, &core_module); + if (csd != NULL) + (void) apr_os_sock_get(&sockfd, csd); + } +#else + sockfd = ap_bfileno(r->connection->client, B_RD); +#endif + if (sockfd != -1) { + (void) papiAttributeListAddInteger(&request, + PAPI_ATTR_EXCL, "peer-socket", sockfd); + } /* process the request */ status = ipp_process_request(request, &response, read_data, r); if (status != PAPI_OK) { errno = 0; _log_rerror(APLOG_MARK, APLOG_ERR, r, - "request failed: %s\n", papiStatusString(status)); + "request failed: %s\n", papiStatusString(status)); discard_data(r); } #ifdef DEBUG @@ -316,7 +336,7 @@ ipp_handler(request_rec *r) * remain in the post request. */ if ((r->read_chunked != 0) && - (ap_table_get(r->headers_in, "Content-Length") == NULL)) + (apr_table_get(r->headers_in, "Content-Length") == NULL)) discard_data(r); /* write an IPP response back to the network */ @@ -329,7 +349,7 @@ ipp_handler(request_rec *r) status = ipp_write_message(write_data, r, response); if (status != PAPI_OK) _log_rerror(APLOG_MARK, APLOG_ERR, r, - "write failed: %s\n", papiStatusString(status)); + "write failed: %s\n", papiStatusString(status)); #ifdef DEBUG fprintf(stderr, "write result: %s\n", papiStatusString(status)); fflush(stderr); @@ -342,7 +362,7 @@ ipp_handler(request_rec *r) ap_kill_timeout(r); if (ap_rflush(r) < 0) _log_rerror(APLOG_MARK, APLOG_ERR, r, - "flush failed, response may not have been sent"); + "flush failed, response may not have been sent"); #endif return (OK); @@ -359,11 +379,11 @@ create_ipp_dir_config( #endif char *dirspec) { - IPPListenerConfig *config = + IPPListenerConfig *config; #ifndef APACHE2 - ap_pcalloc(p, sizeof (*config)); + config = ap_pcalloc(p, sizeof (*config)); #else - apr_pcalloc(p, sizeof (*config)); + config = apr_pcalloc(p, sizeof (*config)); #endif if (config != NULL) { @@ -371,8 +391,8 @@ create_ipp_dir_config( config->conformance = IPP_PARSE_CONFORMANCE_RASH; config->default_user = NULL; config->default_svc = NULL; - (void) ipp_configure_operation(&config->operations, "required", - "enable"); + (void) ipp_configure_operation(&config->operations, + "required", "enable"); } return (config); @@ -399,12 +419,13 @@ ipp_conformance(cmd_parms *cmd, void *cfg, const char *arg) /*ARGSUSED0*/ static const char * -ipp_operation(cmd_parms *cmd, void *cfg, char *op, char *toggle) +ipp_operation(cmd_parms *cmd, void *cfg, const char *op, const char *toggle) { IPPListenerConfig *config = (IPPListenerConfig *)cfg; papi_status_t status; - status = ipp_configure_operation(&config->operations, op, toggle); + status = ipp_configure_operation(&config->operations, + (char *)op, (char *)toggle); switch (status) { case PAPI_OK: return (NULL); @@ -440,13 +461,17 @@ ipp_default_svc(cmd_parms *cmd, void *cfg, const char *arg) #ifdef DEBUG /*ARGSUSED0*/ +volatile int ipp_module_hang_sleeping = 1; static const char * ipp_module_hang(cmd_parms *cmd, void *cfg) { - static int i = 1; - /* wait so we can attach a debugger, assign i = 0, and step through */ - while (i); + /* + * Wait so we can attach with a debugger. Once attached, + * assign ipp_module_hang_sleeping = 0 and step through. + */ + while (ipp_module_hang_sleeping) + sleep(1); return (NULL); } @@ -472,7 +497,7 @@ static const command_rec ipp_cmds[] = #ifdef APACHE2 /*ARGSUSED0*/ static const char * -ipp_method(const request_rec *r) +ipp_scheme(const request_rec *r) { return ("ipp"); } @@ -494,7 +519,7 @@ ipp_register_hooks(apr_pool_t *p) /* Need to make sure we don't get directory listings by accident */ ap_hook_handler(ipp_handler, NULL, modules, APR_HOOK_MIDDLE); ap_hook_default_port(ipp_port, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_http_method(ipp_method, NULL, NULL, APR_HOOK_MIDDLE); + ap_hook_http_scheme(ipp_scheme, NULL, NULL, APR_HOOK_MIDDLE); } module AP_MODULE_DECLARE_DATA ipp_module = { diff --git a/usr/src/man/man1m/boot.1m b/usr/src/man/man1m/boot.1m index deb21f1182..07de722086 100644 --- a/usr/src/man/man1m/boot.1m +++ b/usr/src/man/man1m/boot.1m @@ -1,10 +1,11 @@ '\" te +.\" Copyright 2015 Nexenta Systems Inc. .\" Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved .\" Copyright 1989 AT&T .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the .\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH BOOT 1M "Mar 2, 2009" +.TH BOOT 1M "Jan 14, 2015" .SH NAME boot \- start the system kernel or a standalone program .SH SYNOPSIS @@ -23,7 +24,6 @@ boot \- start the system kernel or a standalone program .fi .SH DESCRIPTION -.sp .LP Bootstrapping is the process of loading and executing a standalone program. For the purpose of this discussion, bootstrapping means the process of loading and @@ -44,7 +44,6 @@ Once the kernel is loaded, it starts the UNIX system, mounts the necessary file systems (see \fBvfstab\fR(4)), and runs \fB/sbin/init\fR to bring the system to the "initdefault" state specified in \fB/etc/inittab\fR. See \fBinittab\fR(4). .SS "SPARC Bootstrap Procedure" -.sp .LP On SPARC based systems, the bootstrap procedure on most machines consists of the following basic phases. @@ -424,7 +423,6 @@ of the \fB-o\fR options, subject to the OBP limit of 128 bytes for boot arguments. For example, \fB-o\fR \fBlist,go\fR would simply list current (default) values of the parameters and then continue booting. .SS "iSCSI Boot" -.sp .LP iSCSI boot is currently supported only on x86. The host being booted must be equipped with NIC(s) capable of iBFT (iSCSI Boot Firmware Table) or have the @@ -441,7 +439,6 @@ of the process of iSCSI booting is the same as booting from a local disk. To configure the iBFT properly, users need to refer to the documentation from their hardware vendors. .SS "Booting from Disk" -.sp .LP When booting from disk, the OpenBoot PROM firmware reads the boot blocks from blocks 1 to 15 of the partition specified as the boot device. This standalone @@ -473,7 +470,6 @@ system and the capabilities of the hardware and firmware. .LP The path to the kernel must not contain any whitespace. .SS "Booting from ZFS" -.sp .LP Booting from ZFS differs from booting from UFS in that, with ZFS, a device specifier identifies a storage pool, not a single root file system. A storage @@ -485,7 +481,6 @@ the one identified by the pool's \fBbootfs\fR property. This default selection can be overridden by specifying an alternate bootable dataset with the \fB-Z\fR option. .SS "Boot Archive Phase" -.sp .LP The boot archive contains a file system image that is mounted using an in-memory disk. The image is self-describing, specifically containing a file @@ -512,7 +507,6 @@ modules from the in-memory filesystem until I/O can be turned on and the root filesystem mounted. Once the root filesystem is mounted, the in-memory filesystem is no longer needed and is discarded. .SS "OpenBoot PROM \fBboot\fR Command Behavior" -.sp .LP The OpenBoot \fBboot\fR command takes arguments of the following form: .sp @@ -931,7 +925,6 @@ using infinite retries. attempted before the DHCP process is determined to have failed. Defaults to of using infinite retries. .SS "x86 Bootstrap Procedure" -.sp .LP On x86 based systems, the bootstrapping process consists of two conceptually distinct phases, kernel loading and kernel initialization. Kernel loading is @@ -970,7 +963,6 @@ the root file system on the real root device. At this point, the kernel regains storage I/O, mounts additional file systems (see \fBvfstab\fR(4)), and starts various operating system services (see \fBsmf\fR(5)). .SS "Failsafe Mode" -.sp .LP A requirement of booting from a root filesystem image built into a boot archive then remounting root onto the actual root device is that the contents of the @@ -1030,14 +1022,12 @@ service, the administrator may elect to rebuild the archive by invoking: .sp .SS "Failsafe Boot Archive" -.sp .LP The failsafe archive can be used to boot the machine at any time for maintenance or troubleshooting. The failsafe boot archive is installed on the machine, sourced from the miniroot archive. Booting the failsafe archive causes the machine to boot using the in-memory filesystem as the root device. .SS "SPARC" -.sp .LP The SPARC failsafe archive is: .sp @@ -1072,7 +1062,6 @@ ok \fBboot [\fIdevice-specifier\fR] -Z \fIdataset\fR -F failsafe\fR .sp .SS "x86" -.sp .LP The x86 failsafe archive is: .sp @@ -1089,7 +1078,6 @@ The x86 failsafe archive is: GRUB menu. .SH OPTIONS .SS "SPARC" -.sp .LP The following SPARC options are supported: .sp @@ -1214,7 +1202,6 @@ Boot from the root file system in the specified ZFS dataset. .RE .SS "x86" -.sp .LP The following x86 options are supported: .sp @@ -1267,7 +1254,6 @@ the machine. .RE .SH X86 BOOT SEQUENCE DETAILS -.sp .LP After a PC-compatible machine is turned on, the system firmware in the \fBBIOS ROM\fR executes a power-on self test (POST), runs \fBBIOS\fR extensions in @@ -1277,7 +1263,6 @@ consists of trying to read the first physical sector from the first diskette drive, or, if that fails, from the first hard disk. The processor then jumps to the first byte of the sector image in memory. .SH X86 PRIMARY BOOT -.sp .LP The first sector on a floppy disk contains the master boot block (GRUB \fBstage1\fR). The stage 1 is responsible for loading GRUB \fBstage2\fR. Now @@ -1295,7 +1280,7 @@ program that maintains it. The master boot finds the active partition in the first byte in memory. This completes the standard PC-compatible hard disk boot sequence. If GRUB \fBstage1\fR is installed on the master boot block (see the \fB-m\fR option of \fBinstallgrub\fR(1M)), then \fBstage2\fR is loaded directly -from the Solaris \fBFDISK\fR partition regardless of the active partition. +from the Solaris partition regardless of the active partition. .sp .LP An x86 \fBFDISK\fR partition for the Solaris software begins with a @@ -1312,6 +1297,13 @@ GRUB menu is displayed, the user can choose to boot an operating system on a different partition, a different disk, or possibly from the network. .sp .LP +The behavior is slightly different when a disk is using \fBEFI\fR +partitioning. In that case the GRUB \fBstage1\fR is always installed +in the first sector of the disk, and it always loads \fBstage2\fR from +the partition specified at GRUB installation time. This only works on +partitions containing a ZFS root pool. +.sp +.LP For network booting, the supported method is Intel's Preboot eXecution Environment (PXE) standard. When booting from the network using PXE, the system or network adapter BIOS uses DHCP to locate a network bootstrap program @@ -1320,7 +1312,6 @@ Protocol (TFTP). The BIOS executes the \fBpxegrub\fR by jumping to its first byte in memory. The \fBpxegrub\fR program downloads a menu file and presents the entries to user. .SH X86 KERNEL STARTUP -.sp .LP The kernel startup process is independent of the kernel loading process. During kernel startup, console I/O goes to the device specified by the \fBconsole\fR @@ -1486,7 +1477,6 @@ to \fB/boot/grub/menu.lst\fR, and use the \fBset-menu\fR subcommand of \fBbootadm set-menu\fR. .SH FILES -.sp .ne 2 .na \fB\fB/platform/\fR\fIplatform-name\fR\fB/ufsboot\fR\fR @@ -1517,7 +1507,6 @@ Program that brings the system to the \fBinitdefault\fR state .RE .SS "64-bit SPARC Only" -.sp .ne 2 .na \fB\fB/platform/\fR\fIplatform-name\fR\fB/kernel/sparcv9/unix\fR\fR @@ -1528,7 +1517,6 @@ Default program to boot system. .RE .SS "x86 Only" -.sp .ne 2 .na \fB\fB/boot\fR\fR @@ -1559,7 +1547,6 @@ Menu of bootable operating systems displayed by GRUB. .RE .SS "64-bit x86 Only" -.sp .ne 2 .na \fB\fB/platform/i86pc/kernel/amd64/unix\fR\fR @@ -1570,7 +1557,6 @@ Menu of bootable operating systems displayed by GRUB. .RE .SH SEE ALSO -.sp .LP \fBkmdb\fR(1), \fBuname\fR(1), \fBbootadm\fR(1M), \fBeeprom\fR(1M), \fBinit\fR(1M), \fBinstallboot\fR(1M), \fBkernel\fR(1M), \fBmonitor\fR(1M), @@ -1603,14 +1589,12 @@ RFC 2396, \fIUniform Resource Identifiers (URI): Generic Syntax\fR, .LP \fIOpenBoot Command Reference Manual\fR .SH WARNINGS -.sp .LP The \fBboot\fR utility is unable to determine which files can be used as bootable programs. If the booting of a file that is not bootable is requested, the \fBboot\fR utility loads it and branches to it. What happens after that is unpredictable. .SH NOTES -.sp .LP \fIplatform-name\fR can be found using the \fB-i\fR option of \fBuname\fR(1). \fIhardware-class-name\fR can be found using the \fB-m\fR option of diff --git a/usr/src/man/man1m/installgrub.1m b/usr/src/man/man1m/installgrub.1m index 57aaab893c..b6d64978db 100644 --- a/usr/src/man/man1m/installgrub.1m +++ b/usr/src/man/man1m/installgrub.1m @@ -1,9 +1,10 @@ '\" te +.\" Copyright 2015 Nexenta Systems Inc. .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH INSTALLGRUB 1M "Jul 2, 2009" +.TH INSTALLGRUB 1M "Jan 14, 2015" .SH NAME installgrub \- install GRUB in a disk partition or a floppy .SH SYNOPSIS @@ -13,7 +14,6 @@ installgrub \- install GRUB in a disk partition or a floppy .fi .SH DESCRIPTION -.sp .LP The \fBinstallgrub\fR command is an x86-only program. GRUB stands for GRand Unified Bootloader. @@ -23,7 +23,6 @@ Unified Bootloader. disk partition. If you specify the \fB-m\fR option, \fBinstallgrub\fR installs the stage 1 file on the master boot sector of the disk. .SH OPTIONS -.sp .LP The \fBinstallgrub\fR command accepts the following options: .sp @@ -42,11 +41,11 @@ Suppresses interaction when overwriting the master boot sector. .ad .RS 6n Installs GRUB \fIstage1\fR on the master boot sector interactively. You must -use this option if Solaris is installed on an extended partition. +use this option if Solaris is installed on an extended FDISK or an EFI/GPT +partition. .RE .SH OPERANDS -.sp .LP The \fBinstallgrub\fR command accepts the following operands: .sp @@ -114,7 +113,6 @@ example# mount -F pcfs /dev/diskette /mnt .in -2 .SH FILES -.sp .ne 2 .na \fB\fB/boot/grub\fR\fR @@ -124,7 +122,6 @@ Directory where GRUB files reside. .RE .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -140,12 +137,10 @@ Interface Stability Uncommitted .TE .SH SEE ALSO -.sp .LP \fBboot\fR(1M), \fBfdisk\fR(1M), \fBfmthard\fR(1M), \fBkernel\fR(1M), \fBattributes\fR(5) .SH WARNINGS -.sp .LP Installing GRUB on the master boot sector (\fB-m\fR option) overrides any boot manager currently installed on the machine. The system will always boot the diff --git a/usr/src/man/man1m/rpcinfo.1m b/usr/src/man/man1m/rpcinfo.1m index 24df1c4527..7151ccea0f 100644 --- a/usr/src/man/man1m/rpcinfo.1m +++ b/usr/src/man/man1m/rpcinfo.1m @@ -1,16 +1,17 @@ '\" te +.\" Copyright 2015 Nexenta Systems, Inc. All rights reserved. .\" Copyright (c) 2001 Sun Microsystems, Inc. All Rights Reserved .\" Copyright 1989 AT&T .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH RPCINFO 1M "Jul 13, 2001" +.TH RPCINFO 1M "Feb 20, 2015" .SH NAME rpcinfo \- report RPC information .SH SYNOPSIS .LP .nf -\fBrpcinfo\fR [\fB-m\fR | \fB-s\fR] [\fIhost\fR] +\fBrpcinfo\fR [\fB-T\fR \fItransport\fR] [\fB-m\fR | \fB-s\fR] [\fIhost\fR] .fi .LP @@ -54,7 +55,6 @@ rpcinfo \- report RPC information .fi .SH DESCRIPTION -.sp .LP \fBrpcinfo\fR makes an \fBRPC\fR call to an \fBRPC\fR server and reports what it finds. @@ -95,7 +95,6 @@ required for \fB-b\fR and \fB-d\fR options. .LP The \fBEXAMPLES\fR section describe other ways of using \fBrpcinfo\fR. .SH OPTIONS -.sp .ne 2 .na \fB\fB-T\fR\fI transport\fR\fR @@ -280,7 +279,7 @@ The information displayed by the above commands can be quite lengthy. Use the .TS l l l l l l l l l l . -\fBprogram\fR \fBvrsn\fR \fBnetid(s)\fR \fBservice\fR \fBowner\fR +\fBprogram\fR \fBversion(s)\fR \fBnetid(s)\fR \fBservice\fR \fBowner\fR \fB100000\fR \fB2,3,4\fR \fBtcp,udp,ticlts,ticots,ticotsord\fR \fBrpcbind\fR \fBsuperuser\fR \fB100008\fR \fB1\fR \fBticotsord,ticots,ticlts,udp,tcp\fR \fBwalld\fR \fBsuperuser\fR \fB100002\fR \fB2,1\fR \fBticotsord,ticots,ticlts,udp,tcp\fR \fBrusersd\fR \fBsuperuser\fR @@ -288,7 +287,7 @@ l l l l l . \fB100012\fR \fB1\fR \fBticotsord,ticots,ticlts,udp,tcp\fR \fBsprayd\fR \fBsuperuser\fR \fB100007\fR \fB3\fR \fBticotsord,ticots,ticlts,udp,tcp\fR \fBypbind\fR \fBsuperuser\fR \fB100029\fR \fB1\fR \fBticotsord,ticots,ticlts\fR \fBkeyserv\fR \fBsuperuser\fR -\fB100078\fR \fB4\fR \fBticotsord,ticots,ticlts\fR \fB-\fR superuser +\fB100078\fR \fB4\fR \fBticotsord,ticots,ticlts\fR \fB-\fR \fBsuperuser\fR \fB100024\fR \fB1\fR \fBticotsord,ticots,ticlts,udp,tcp\fR \fBstatus\fR \fBsuperuser\fR \fB100021\fR \fB2,1\fR \fBticotsord,ticots,ticlts,udp,tcp\fR \fBnlockmgr\fR \fBsuperuser\fR \fB100020\fR \fB1\fR \fBticotsord,ticots,ticlts,udp,tcp\fR \fBllockmgr\fR \fBsuperuser\fR @@ -347,7 +346,6 @@ or .sp .SH SEE ALSO -.sp .LP \fBrpcbind\fR(1M), \fBrpc\fR(3NSL), \fBnetconfig\fR(4), \fBrpc\fR(4), \fBattributes\fR(5) diff --git a/usr/src/man/man1m/svccfg.1m b/usr/src/man/man1m/svccfg.1m index c2e2cf28cd..cbb1a7ef29 100644 --- a/usr/src/man/man1m/svccfg.1m +++ b/usr/src/man/man1m/svccfg.1m @@ -24,7 +24,6 @@ svccfg \- import, export, and modify service configurations .fi .SH DESCRIPTION -.sp .LP The \fBsvccfg\fR command manipulates data in the service configuration repository. \fBsvccfg\fR can be invoked interactively, with an individual @@ -37,7 +36,6 @@ effect for that service until the next time the service instance is refreshed. See the \fBrefresh\fR subcommand on the \fBsvcadm\fR(1M) man page for more details. .SH OPTIONS -.sp .LP The following options are supported: .sp @@ -72,7 +70,6 @@ Verbose. .RE .SH SUBCOMMANDS -.sp .LP Subcommands are divided into the categories specified in the subsections that follow. @@ -124,7 +121,6 @@ Abbreviated forms of \fIFMRI\fRs are unstable, and should not be used in scripts or other permanent tools. If a pattern matches more than one instance or service, an error message is printed and no action is taken. .SS "General Subcommands" -.sp .ne 2 .na \fB\fBend\fR\fR @@ -189,7 +185,6 @@ Turns off verbose mode. .RE .SS "Service Profile Subcommands" -.sp .ne 2 .na \fB\fBapply\fR [\fB-n\fR] \fIfile\fR\fR @@ -225,7 +220,6 @@ a file. .RE .SS "Service Manifest Subcommands" -.sp .ne 2 .na \fB\fBarchive\fR [\fB-a\fR]\fR @@ -360,7 +354,6 @@ See \fBsmf_template\fR(5) for a description of templates. .RE .SS "Entity Selection, Modification, and Navigation Subcommands" -.sp .LP An "entity" refers to a scope, service, or service instance. .sp @@ -428,7 +421,6 @@ The parent of the current selection becomes the current selection. .RE .SS "Property Inspection and Modification Subcommands" -.sp .ne 2 .na \fB\fBaddpg\fR \fIname\fR \fItype\fR [\fIflags\fR]\fR @@ -639,7 +631,6 @@ modify properties. .RE .SS "Snapshot Navigation and Selection Subcommands" -.sp .ne 2 .na \fB\fBlistsnap\fR\fR @@ -676,7 +667,6 @@ read-only. .RE .SS "Instance Subcommands" -.sp .ne 2 .na \fB\fBrefresh\fR\fR @@ -797,7 +787,6 @@ ttymon/label astring console .sp .SH ENVIRONMENTAL VARIABLES -.sp .ne 2 .na \fBEDITOR\fR @@ -809,7 +798,6 @@ editor is \fBvi\fR(1). .RE .SH EXIT STATUS -.sp .LP The following exit values are returned: .sp @@ -844,7 +832,6 @@ Invalid command line options were specified. .RE .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -864,7 +851,6 @@ Interface Stability See below. The interactive output is Uncommitted. The invocation and non-interactive output are Committed. .SH SEE ALSO -.sp .LP \fBsvcprop\fR(1), \fBsvcs\fR(1), \fBsvcadm\fR(1M), \fBsvc.configd\fR(1M), \fBlibscf\fR(3LIB), \fBlibumem\fR(3LIB), \fBscf_service_add_pg\fR(3SCF), diff --git a/usr/src/man/man3socket/Makefile b/usr/src/man/man3socket/Makefile index c4bbd116c7..5174020548 100644 --- a/usr/src/man/man3socket/Makefile +++ b/usr/src/man/man3socket/Makefile @@ -63,9 +63,11 @@ MANLINKS= accept4.3socket \ endprotoent.3socket \ endservent.3socket \ ether_aton.3socket \ + ether_aton_r.3socket \ ether_hostton.3socket \ ether_line.3socket \ ether_ntoa.3socket \ + ether_ntoa_r.3socket \ ether_ntohost.3socket \ freeaddrinfo.3socket \ freehostent.3socket \ @@ -155,9 +157,11 @@ ntohll.3socket := LINKSRC = byteorder.3socket ntohs.3socket := LINKSRC = byteorder.3socket ether_aton.3socket := LINKSRC = ethers.3socket +ether_aton_r.3socket := LINKSRC = ethers.3socket ether_hostton.3socket := LINKSRC = ethers.3socket ether_line.3socket := LINKSRC = ethers.3socket ether_ntoa.3socket := LINKSRC = ethers.3socket +ether_ntoa_r.3socket := LINKSRC = ethers.3socket ether_ntohost.3socket := LINKSRC = ethers.3socket freeaddrinfo.3socket := LINKSRC = getaddrinfo.3socket diff --git a/usr/src/man/man3socket/ethers.3socket b/usr/src/man/man3socket/ethers.3socket index 94cec9c957..77a5e330a6 100644 --- a/usr/src/man/man3socket/ethers.3socket +++ b/usr/src/man/man3socket/ethers.3socket @@ -1,12 +1,13 @@ '\" te .\" Copyright 1989 AT&T. .\" Copyright (C) 2004, Sun Microsystems, Inc. All Rights Reserved. +.\" Copyright (C) 2014, Joyent, Inc. All Rights Reserved. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH ETHERS 3SOCKET "Apr 5, 2004" +.TH ETHERS 3SOCKET "Aug 9, 2014" .SH NAME -ethers, ether_ntoa, ether_aton, ether_ntohost, ether_hostton, ether_line \- +ethers, ether_ntoa, ether_ntoa_r, ether_aton, ether_aton_r, ether_ntohost, ether_hostton, ether_line \- Ethernet address mapping operations .SH SYNOPSIS .LP @@ -20,11 +21,21 @@ Ethernet address mapping operations .LP .nf +\fBchar *\fR\fBether_ntoa_r\fR(\fBconst struct ether_addr *\fR\fIe\fR, \fBchar *\fR\fIs\fR); +.fi + +.LP +.nf \fBstruct ether_addr *\fR\fBether_aton\fR(\fBconst char *\fR\fIs\fR); .fi .LP .nf +\fBstruct ether_addr *\fR\fBether_aton_r\fR(\fBconst char *\fR\fIs\fR, \fBstruct ether_addr *\fR\fIe\fR); +.fi + +.LP +.nf \fBint\fR \fBether_ntohost\fR(\fBchar *\fR\fIhostname\fR, \fBconst struct ether_addr *\fR\fIe\fR); .fi @@ -39,7 +50,6 @@ Ethernet address mapping operations .fi .SH DESCRIPTION -.sp .LP These routines are useful for mapping 48 bit Ethernet numbers to their ASCII representations or their corresponding host names, and vice versa. @@ -55,6 +65,18 @@ representation back to a 48 bit Ethernet number; the function returns \fINULL\fR if the string cannot be scanned successfully. .sp .LP +The functions \fBether_ntoa()\fR and \fBether_aton()\fR return values in +per-thread buffers, one for each function. A second call to one of these +functions will overwrite the previous value. The functions +\fBether_ntoa_r()\fR and \fBether_aton_r()\fR behave identically to +their non-reentrant versions; however, instead of using a per-thread +buffer, they use caller supplied buffers. It is the callers +responsibility to ensure that the character buffer passed to +\fBether_ntoa_r()\fR is at least \fBETHERADDRSTRL\fR bytes large -- the +minimum size to hold the ASCII representation of a 48 bit Ethernet +number and a null terminator. +.sp +.LP The function \fBether_ntohost()\fR maps an Ethernet number (pointed to by \fIe\fR) to its associated hostname. The string pointed to by hostname must be long enough to hold the hostname and a \fINULL\fR character. The function @@ -75,7 +97,6 @@ to by hostname must be long enough to hold the hostname and a \fINULL\fR character. The function returns zero upon success and non-zero upon failure. The format of the scanned line is described by \fBethers\fR(4). .SH FILES -.sp .ne 2 .na \fB\fB/etc/ethers\fR\fR @@ -94,7 +115,6 @@ configuration file for the name service switch .RE .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -110,6 +130,5 @@ MT-Level MT-Safe .TE .SH SEE ALSO -.sp .LP \fBethers\fR(4), \fBnsswitch.conf\fR(4), \fBattributes\fR(5) diff --git a/usr/src/man/man4/mod_ipp.4 b/usr/src/man/man4/mod_ipp.4 index b4a8c26580..672bca7a01 100644 --- a/usr/src/man/man4/mod_ipp.4 +++ b/usr/src/man/man4/mod_ipp.4 @@ -1,21 +1,32 @@ '\" te .\" Copyright (c) 2003, Sun Microsystems, Inc. .\" All Rights Reserved. -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. -.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH MOD_IPP 4 "Nov 26, 2003" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" +.TH MOD_IPP 4 "Feb 14, 2015" .SH NAME mod_ipp \- Embedded Internet Print Protocol (IPP) listener for the Apache HTTP server .SH SYNOPSIS .LP .nf -\fB/usr/apache/libexec/mod_ipp.so\fR +\fB/usr/lib/lp/ipp/mod_ipp.so\fR .fi .SH DESCRIPTION -.sp .LP The \fBmod_ipp\fR module implements RFCs 2910 and 2911 to provide an IPP handling service for the Apache HTTP server. When loaded on the Apache server, @@ -23,7 +34,6 @@ handling service for the Apache HTTP server. When loaded on the Apache server, \fBapplication/ipp\fR. The \fBmod_ipp\fR module also processes additional configuration directives to enable or disable portions of the protocol support. .SS "Using Configuration Directives" -.sp .LP The following is a list of configuration directives that apply to the Apache IPP Listening service: @@ -50,7 +60,6 @@ will disable support for the named operation. .RE .RE .SS "Operations" -.sp .LP The following is a list of IPP handling service operations: .sp @@ -248,83 +257,20 @@ operations implemented by the \fBmod_ipp\fR Apache module. The following configuration file can be used to start a standalone Apache server to respond to IPP request sent to port 631. -.sp -.in +2 -.nf -ServerType standalone -ServerRoot "/usr/apache" -PidFile /var/run/httpd-standalone-ipp.pid -ErrorLog /var/lp/logs/ipp-errors - -Timeout 300 -KeepAlive On -MaxKeepAliveRequests 100 -KeepAliveTimeout 15 - -MinSpareServers 1 -MaxSpareServers 3 -StartServers 1 -MaxClients 150 -MaxRequestsPerChild 0 - -LoadModule ipp_module libexec/mod_ipp.so - -ClearModuleList -AddModule mod_ipp.c -AddModule mod_so.c - -Port 631 - -User lp -Group lp - -ServerAdmin lp@localhost -DefaultType application/ipp - -<IFModule mod_app> - <Location /> - ipp-operation all on - </Location> -</IFModule mod_app> -.fi -.in -2 - -.sp -.LP -A more restrictive configuration might include the following parameters: - -.sp -.in +2 +See .nf -<IFModule mod_app> - <Location /> - ipp-operation all offn - ipp-operation required on - </Location> -</IFModule mod_app> + \fB/etc/lp/ipp/httpd-standalone-ipp.conf\fR .fi -.in -2 -.SH ATTRIBUTES -.sp -.LP -See \fBattributes\fR(5) or descriptions of the following attributes: -.sp - -.sp -.TS -box; -c | c -l | l . -ATTRIBUTE TYPE ATTRIBUTE VALUE -_ -Interface Stability External -.TE +Note that this will require a usable printer configured under the +\fBlp\fR print system. See \fBlpadmin\fR(1M) for details. +The CUPS printing system has its own IPP listener separate from +this Apache module. See \fBprint-service\fR for instructions +on switching between the \fBlp\fR and \fBcups\fR systems. .SH SEE ALSO -.sp .LP -\fBman\fR(1), \fBcatman\fR(1M), \fBattributes\fR(5) +\fBlp\fR(1), \fBlpadmin\fR(1M), \fBprint-service\fR(1M) .sp .LP Herriot, R., Ed., Butler, S., Moore, P., Turner, R., Wenn, J. \fIRFC 2910, @@ -339,7 +285,6 @@ Group. September 2000. .LP http://www.apache.org .SH NOTES -.sp .LP Configuration file directives are processed in the order listed in the config file. The default behavior is to enable support for all operations implemented @@ -390,7 +335,6 @@ information is available at http://www.apache.org .sp .LP The \fBhttpd\fR(8) man page and other Apache man pages are provided with the -programming modules. To view the Apache manual pages with the man command, add -\fB/usr/apache/man\fR to the \fBMANPATH\fR environment variable. See -\fBman\fR(1) for more information. Running \fBcatman\fR(1M) on the Apache -manual pages is not supported. +programming modules. To view the Apache manual pages with the man command, +add (i.e.) \fB/usr/apache2/2.2/man\fR to the \fBMANPATH\fR environment +variable. See \fBman\fR(1) for more information. diff --git a/usr/src/pkg/manifests/print-lp-ipp-ipp-listener.mf b/usr/src/pkg/manifests/print-lp-ipp-ipp-listener.mf index fe8c53ad36..5fc3fbc269 100644 --- a/usr/src/pkg/manifests/print-lp-ipp-ipp-listener.mf +++ b/usr/src/pkg/manifests/print-lp-ipp-ipp-listener.mf @@ -31,23 +31,24 @@ set name=info.classification \ value=org.opensolaris.category.2008:System/Printing set name=variant.arch value=$(ARCH) dir path=etc group=sys -dir path=etc/apache +dir path=etc/lp group=lp mode=0775 owner=lp +dir path=etc/lp/ipp group=lp mode=0755 owner=lp dir path=lib dir path=lib/svc dir path=lib/svc/manifest group=sys dir path=lib/svc/manifest/application group=sys dir path=lib/svc/manifest/application/print group=sys dir path=usr group=sys -dir path=usr/apache -dir path=usr/apache/libexec +dir path=usr/lib +dir path=usr/lib/lp group=lp +dir path=usr/lib/lp/ipp group=lp dir path=var group=sys dir path=var/lp group=lp mode=0775 owner=lp dir path=var/lp/ipp-listener -file path=etc/apache/httpd-standalone-ipp.conf \ - original_name=SUNWippl:etc/apache/httpd-standalone-ipp.conf preserve=true +file path=etc/lp/ipp/httpd-standalone-ipp.conf preserve=true file path=lib/svc/manifest/application/print/ipp-listener.xml group=sys \ mode=0444 -file path=usr/apache/libexec/mod_ipp.so mode=0555 +file path=usr/lib/lp/ipp/mod_ipp.so mode=0555 file path=var/lp/ipp-listener/index.html mode=0444 legacy pkg=SUNWipplr \ desc="Internet Printing Protocol(IPP) Apache configuration for service module" \ diff --git a/usr/src/pkg/manifests/system-library.man3socket.inc b/usr/src/pkg/manifests/system-library.man3socket.inc index b3f8ca66d9..6b1ea6641b 100644 --- a/usr/src/pkg/manifests/system-library.man3socket.inc +++ b/usr/src/pkg/manifests/system-library.man3socket.inc @@ -61,9 +61,11 @@ link path=usr/share/man/man3socket/endprotoent.3socket \ link path=usr/share/man/man3socket/endservent.3socket \ target=getservbyname.3socket link path=usr/share/man/man3socket/ether_aton.3socket target=ethers.3socket +link path=usr/share/man/man3socket/ether_aton_r.3socket target=ethers.3socket link path=usr/share/man/man3socket/ether_hostton.3socket target=ethers.3socket link path=usr/share/man/man3socket/ether_line.3socket target=ethers.3socket link path=usr/share/man/man3socket/ether_ntoa.3socket target=ethers.3socket +link path=usr/share/man/man3socket/ether_ntoa_r.3socket target=ethers.3socket link path=usr/share/man/man3socket/ether_ntohost.3socket target=ethers.3socket link path=usr/share/man/man3socket/freeaddrinfo.3socket \ target=getaddrinfo.3socket diff --git a/usr/src/uts/common/fs/zfs/vdev.c b/usr/src/uts/common/fs/zfs/vdev.c index 6ee2a91dbd..9bc46ce64d 100644 --- a/usr/src/uts/common/fs/zfs/vdev.c +++ b/usr/src/uts/common/fs/zfs/vdev.c @@ -21,8 +21,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ #include <sys/zfs_context.h> @@ -3204,8 +3204,6 @@ vdev_is_bootable(vdev_t *vd) strcmp(vdev_type, VDEV_TYPE_MISSING) == 0) { return (B_FALSE); } - } else if (vd->vdev_wholedisk == 1) { - return (B_FALSE); } for (int c = 0; c < vd->vdev_children; c++) { diff --git a/usr/src/uts/common/sys/ethernet.h b/usr/src/uts/common/sys/ethernet.h index 6c9aeef4af..5b9de2f2bf 100644 --- a/usr/src/uts/common/sys/ethernet.h +++ b/usr/src/uts/common/sys/ethernet.h @@ -38,6 +38,7 @@ extern "C" { #define ETHERADDRL (6) /* ethernet address length in octets */ #define ETHERFCSL (4) /* ethernet FCS length in octets */ +#define ETHERADDRSTRL (18) /* char size of ETHERADDRL with null */ /* * Ethernet address - 6 octets @@ -144,7 +145,9 @@ extern char *ether_sprintf(struct ether_addr *); extern int ether_aton(char *, uchar_t *); #else /* _KERNEL */ extern char *ether_ntoa(const struct ether_addr *); +extern char *ether_ntoa_r(const struct ether_addr *, char *); extern struct ether_addr *ether_aton(const char *); +extern struct ether_addr *ether_aton_r(const char *, struct ether_addr *); extern int ether_ntohost(char *, const struct ether_addr *); extern int ether_hostton(const char *, struct ether_addr *); extern int ether_line(const char *, struct ether_addr *, char *); |