Print this page
4577 pfexec's error reporting is (at least sometimes) awful

*** 17,26 **** --- 17,27 ---- * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* + * Copyright 2014 Gary Mills * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. */ /* * New implementation of pfexec(1) and all of the profile shells.
*** 100,110 **** priv_set_t *wanted; int oflag; oflag = getpflags(PRIV_PFEXEC); if (setpflags(PRIV_PFEXEC, 1) != 0) { ! perror("setpflags(PRIV_PFEXEC)"); exit(1); } if (*argv[0] == '-') cmd = argv[0] + 1; --- 101,113 ---- priv_set_t *wanted; int oflag; oflag = getpflags(PRIV_PFEXEC); if (setpflags(PRIV_PFEXEC, 1) != 0) { ! (void) fprintf(stderr, ! gettext("pfexec: unable to set PFEXEC flag: %s\n"), ! strerror(errno)); exit(1); } if (*argv[0] == '-') cmd = argv[0] + 1;
*** 124,134 **** (void) execv(pathbuf, argv); switch (shellname(cmd, pathbuf)) { case RES_OK: (void) execv(pathbuf, argv); ! perror(pathbuf); return (1); case RES_PFEXEC: case RES_FAILURE: while ((c = getopt(argc, argv, "P:")) != EOF) { switch (c) { --- 127,139 ---- (void) execv(pathbuf, argv); switch (shellname(cmd, pathbuf)) { case RES_OK: (void) execv(pathbuf, argv); ! (void) fprintf(stderr, ! gettext("pfexec: unable to execute %s: %s\n"), ! pathbuf, strerror(errno)); return (1); case RES_PFEXEC: case RES_FAILURE: while ((c = getopt(argc, argv, "P:")) != EOF) { switch (c) {
*** 146,166 **** argv += optind; if (argc < 1) usage(); if (pset != NULL) { ! wanted = priv_str_to_set(pset, ",", NULL); if (setppriv(PRIV_ON, PRIV_INHERITABLE, wanted) != 0) { (void) fprintf(stderr, ! gettext("setppriv(): %s\n"), ! strerror(errno)); exit(EXIT_FAILURE); } (void) setpflags(PRIV_PFEXEC, oflag); } (void) execvp(argv[0], argv); ! perror(argv[0]); return (1); } return (1); } --- 151,179 ---- argv += optind; if (argc < 1) usage(); if (pset != NULL) { ! if ((wanted = priv_str_to_set(pset, ",", NULL)) == ! NULL) { ! (void) fprintf(stderr, ! gettext("pfexec: error parsing " ! "privileges: %s\n"), strerror(errno)); ! exit(EXIT_FAILURE); ! } if (setppriv(PRIV_ON, PRIV_INHERITABLE, wanted) != 0) { (void) fprintf(stderr, ! gettext("pfexec: error setting " ! "privileges: %s\n"), strerror(errno)); exit(EXIT_FAILURE); } (void) setpflags(PRIV_PFEXEC, oflag); } (void) execvp(argv[0], argv); ! (void) fprintf(stderr, ! gettext("pfexec: unable to execute %s: %s\n"), ! argv[0], strerror(errno)); return (1); } return (1); }