Print this page
5910 libnisdb won't build with modern GCC


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

  23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #pragma ident   "%Z%%M% %I%     %E% SMI"
  28 
  29 /*
  30  * DESCRIPTION: Contains the map update thread and related code.
  31  */
  32 
  33 #include <unistd.h>
  34 #include <syslog.h>
  35 #include <ndbm.h>
  36 #include <thread.h>
  37 #include <unistd.h>
  38 #include <strings.h>
  39 #include "ypsym.h"
  40 #include "ypdefs.h"
  41 #include "shim.h"
  42 #include "yptol.h"
  43 #include "../ldap_util.h"
  44 
  45 /* Enable standard YP code features defined in ypdefs.h */
  46 USE_YP_PREFIX
  47 USE_YP_MASTER_NAME
  48 USE_YP_LAST_MODIFIED


 341 void *
 342 update_thread(void *arg)
 343 {
 344         void *ret = (void *)-1;
 345         map_ctrl *map;
 346 
 347         /* Cast argument pointer to correct type */
 348         map = (map_ctrl *)arg;
 349 
 350         /* Actually do the work */
 351         if (SUCCESS == update_map_from_dit(map, FALSE))
 352                 ret = 0;
 353 
 354         /* Update complete or failed */
 355         unlock_map_update(map);
 356 
 357         /* Free up duplicate copy of the map_ctrl */
 358         free_map_ctrl(map);
 359 
 360         thr_exit(ret);


 361 }
 362 
 363 /*
 364  * FUNCTION :   is_special_key()
 365  *
 366  * DESCRIPTION: Works out if a given key is one of the special ones. We just
 367  *              check for the "YP_" prefix. This is not 100% safe but if
 368  *              valid keys with a "YP_" prefix exist in the DIT then a lot of
 369  *              other parts of NIS wont work.
 370  */
 371 bool_t
 372 is_special_key(datum *key)
 373 {
 374         if (0 == strncmp(key->dptr, yp_prefix, yp_prefix_sz))
 375                 return (TRUE);
 376 
 377         return (FALSE);
 378 }


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


  28 /*
  29  * DESCRIPTION: Contains the map update thread and related code.
  30  */
  31 
  32 #include <unistd.h>
  33 #include <syslog.h>
  34 #include <ndbm.h>
  35 #include <thread.h>
  36 #include <unistd.h>
  37 #include <strings.h>
  38 #include "ypsym.h"
  39 #include "ypdefs.h"
  40 #include "shim.h"
  41 #include "yptol.h"
  42 #include "../ldap_util.h"
  43 
  44 /* Enable standard YP code features defined in ypdefs.h */
  45 USE_YP_PREFIX
  46 USE_YP_MASTER_NAME
  47 USE_YP_LAST_MODIFIED


 340 void *
 341 update_thread(void *arg)
 342 {
 343         void *ret = (void *)-1;
 344         map_ctrl *map;
 345 
 346         /* Cast argument pointer to correct type */
 347         map = (map_ctrl *)arg;
 348 
 349         /* Actually do the work */
 350         if (SUCCESS == update_map_from_dit(map, FALSE))
 351                 ret = 0;
 352 
 353         /* Update complete or failed */
 354         unlock_map_update(map);
 355 
 356         /* Free up duplicate copy of the map_ctrl */
 357         free_map_ctrl(map);
 358 
 359         thr_exit(ret);
 360 
 361         return (NULL);
 362 }
 363 
 364 /*
 365  * FUNCTION :   is_special_key()
 366  *
 367  * DESCRIPTION: Works out if a given key is one of the special ones. We just
 368  *              check for the "YP_" prefix. This is not 100% safe but if
 369  *              valid keys with a "YP_" prefix exist in the DIT then a lot of
 370  *              other parts of NIS wont work.
 371  */
 372 bool_t
 373 is_special_key(datum *key)
 374 {
 375         if (0 == strncmp(key->dptr, yp_prefix, yp_prefix_sz))
 376                 return (TRUE);
 377 
 378         return (FALSE);
 379 }