Print this page
5763 missing va_end() on return from __fini_daemon_priv()


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*

  23  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 #pragma weak _getprivimplinfo   = getprivimplinfo
  27 #pragma weak _priv_addset       = priv_addset
  28 #pragma weak _priv_allocset     = priv_allocset
  29 #pragma weak _priv_copyset      = priv_copyset
  30 #pragma weak _priv_delset       = priv_delset
  31 #pragma weak _priv_emptyset     = priv_emptyset
  32 #pragma weak _priv_basicset     = priv_basicset
  33 #pragma weak _priv_fillset      = priv_fillset
  34 #pragma weak _priv_freeset      = priv_freeset
  35 #pragma weak _priv_getbyname    = priv_getbyname
  36 #pragma weak _priv_getbynum     = priv_getbynum
  37 #pragma weak _priv_getsetbyname = priv_getsetbyname
  38 #pragma weak _priv_getsetbynum  = priv_getsetbynum
  39 #pragma weak _priv_ineffect     = priv_ineffect
  40 #pragma weak _priv_intersect    = priv_intersect
  41 #pragma weak _priv_inverse      = priv_inverse
  42 #pragma weak _priv_isemptyset   = priv_isemptyset


 554                         (void) core_set_process_path(daemon_cp,
 555                             sizeof (daemon_cp), getpid());
 556                 }
 557         }
 558         (void) setpflags(__PROC_PROTECT, 0);
 559 
 560         return (ret);
 561 }
 562 
 563 /*
 564  * The routine __fini_daemon_priv() is private to Solaris and is
 565  * used by daemons to clear remaining unwanted privileges and
 566  * reenable core dumps.
 567  */
 568 void
 569 __fini_daemon_priv(const char *priv, ...)
 570 {
 571         priv_set_t *nset;
 572         va_list pa;
 573 
 574         va_start(pa, priv);
 575 
 576         if (priv != NULL) {


 577                 nset = priv_vlist(pa);


 578                 if (nset == NULL)
 579                         return;
 580 
 581                 (void) priv_addset(nset, priv);
 582                 (void) setppriv(PRIV_OFF, permitted, nset);
 583                 priv_freeset(nset);
 584         }
 585 
 586         va_end(pa);
 587 
 588         (void) setpflags(__PROC_PROTECT, 0);
 589 }
 590 
 591 /*
 592  * The routine __init_suid_priv() is private to Solaris and is
 593  * used by set-uid root programs to limit the privileges acquired
 594  * to those actually needed.
 595  */
 596 
 597 static priv_set_t *bracketpriv;
 598 
 599 int
 600 __init_suid_priv(int flags, ...)
 601 {
 602         priv_set_t *nset = NULL;
 603         priv_set_t *tmpset = NULL;
 604         va_list pa;
 605         int r = -1;
 606         uid_t ruid, euid;
 607 




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2015 Gary Mills
  24  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  25  */
  26 
  27 #pragma weak _getprivimplinfo   = getprivimplinfo
  28 #pragma weak _priv_addset       = priv_addset
  29 #pragma weak _priv_allocset     = priv_allocset
  30 #pragma weak _priv_copyset      = priv_copyset
  31 #pragma weak _priv_delset       = priv_delset
  32 #pragma weak _priv_emptyset     = priv_emptyset
  33 #pragma weak _priv_basicset     = priv_basicset
  34 #pragma weak _priv_fillset      = priv_fillset
  35 #pragma weak _priv_freeset      = priv_freeset
  36 #pragma weak _priv_getbyname    = priv_getbyname
  37 #pragma weak _priv_getbynum     = priv_getbynum
  38 #pragma weak _priv_getsetbyname = priv_getsetbyname
  39 #pragma weak _priv_getsetbynum  = priv_getsetbynum
  40 #pragma weak _priv_ineffect     = priv_ineffect
  41 #pragma weak _priv_intersect    = priv_intersect
  42 #pragma weak _priv_inverse      = priv_inverse
  43 #pragma weak _priv_isemptyset   = priv_isemptyset


 555                         (void) core_set_process_path(daemon_cp,
 556                             sizeof (daemon_cp), getpid());
 557                 }
 558         }
 559         (void) setpflags(__PROC_PROTECT, 0);
 560 
 561         return (ret);
 562 }
 563 
 564 /*
 565  * The routine __fini_daemon_priv() is private to Solaris and is
 566  * used by daemons to clear remaining unwanted privileges and
 567  * reenable core dumps.
 568  */
 569 void
 570 __fini_daemon_priv(const char *priv, ...)
 571 {
 572         priv_set_t *nset;
 573         va_list pa;
 574 


 575         if (priv != NULL) {
 576 
 577                 va_start(pa, priv);
 578                 nset = priv_vlist(pa);
 579                 va_end(pa);
 580 
 581                 if (nset == NULL)
 582                         return;
 583 
 584                 (void) priv_addset(nset, priv);
 585                 (void) setppriv(PRIV_OFF, permitted, nset);
 586                 priv_freeset(nset);
 587         }
 588 


 589         (void) setpflags(__PROC_PROTECT, 0);
 590 }
 591 
 592 /*
 593  * The routine __init_suid_priv() is private to Solaris and is
 594  * used by set-uid root programs to limit the privileges acquired
 595  * to those actually needed.
 596  */
 597 
 598 static priv_set_t *bracketpriv;
 599 
 600 int
 601 __init_suid_priv(int flags, ...)
 602 {
 603         priv_set_t *nset = NULL;
 604         priv_set_t *tmpset = NULL;
 605         va_list pa;
 606         int r = -1;
 607         uid_t ruid, euid;
 608