Print this page
remove support for non-ANSI compilation

Split Close
Expand all
Collapse all
          --- old/usr/src/head/nss_dbdefs.h
          +++ new/usr/src/head/nss_dbdefs.h
↓ open down ↓ 11 lines elided ↑ open up ↑
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
       22 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
       23 + *
  22   24   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   25   * Use is subject to license terms.
  24   26   *
  25   27   * Database-specific definitions for the getXXXbyYYY routines
  26   28   * (e.g getpwuid_r(), ether_ntohost()) that use the name-service switch.
  27   29   * Database-independent definitions are in <nss_common.h>
  28   30   *
  29   31   * Ideally, this is the only switch header file one would add things
  30   32   * to in order to support a new database.
  31   33   *
↓ open down ↓ 195 lines elided ↑ open up ↑
 227  229   */
 228  230  
 229  231  /*
 230  232   * The nss_str2ent_t routine is the data marshaller for the nsswitch.
 231  233   * it converts 'native files' format into 'entry' format as part of the
 232  234   * return processing for a getXbyY interface.
 233  235   *
 234  236   * The nss_groupstr_t routine does the real work for any backend
 235  237   * that can supply a netgroup entry as a string in /etc/group format
 236  238   */
 237      -#if defined(__STDC__)
 238  239  typedef int             (*nss_str2ent_t)(const char *in, int inlen,
 239  240                                  void *ent, char *buf, int buflen);
 240  241  
 241  242  struct nss_groupsbymem;         /* forward definition */
 242  243  typedef nss_status_t    (*nss_groupstr_t)(const char *instr, int inlen,
 243  244                                  struct nss_groupsbymem *);
 244      -#else
 245      -typedef int             (*nss_str2ent_t)();
 246      -typedef nss_status_t    (*nss_groupstr_t)();
 247      -#endif
 248  245  
 249  246  /*
 250  247   * The initgroups() function [see initgroups(3c)] needs to find all the
 251  248   *   groups to which a given user belongs.  To do this it calls
 252  249   *   _getgroupsbymember(), which is part of the frontend for the "group"
 253  250   *   database.
 254  251   * We want the same effect as if we used getgrent_r() to enumerate the
 255  252   *   entire groups database (possibly from multiple sources), but getgrent_r()
 256  253   *   is too inefficient.  Most backends can do better if they know they're
 257  254   *   meant to scan all groups;  hence there's a separate backend operation,
↓ open down ↓ 111 lines elided ↑ open up ↑
 369  366   * The functions that allocate and free these structures do no locking at
 370  367   * all, since the routines that use them are inherently MT-unsafe anyway.
 371  368   */
 372  369  
 373  370  typedef struct {
 374  371          void            *result;        /* "result" parameter to getXbyY_r() */
 375  372          char            *buffer;        /* "buffer"     "             "      */
 376  373          int             buflen;         /* "buflen"     "             "      */
 377  374  } nss_XbyY_buf_t;
 378  375  
 379      -#if defined(__STDC__)
 380  376  extern nss_XbyY_buf_t   *_nss_XbyY_buf_alloc(int struct_size, int buffer_size);
 381  377  extern void              _nss_XbyY_buf_free(nss_XbyY_buf_t *);
 382      -#else
 383      -extern nss_XbyY_buf_t   *_nss_XbyY_buf_alloc();
 384      -extern void              _nss_XbyY_buf_free();
 385      -#endif
 386  378  
 387  379  #define NSS_XbyY_ALLOC(bufpp, str_size, buf_size)               (\
 388  380          (*bufpp) == 0                                           \
 389  381          ? (*bufpp) = _nss_XbyY_buf_alloc(str_size, buf_size)    \
 390  382          : (*bufpp))
 391  383  
 392  384  #define NSS_XbyY_FREE(bufpp)    (_nss_XbyY_buf_free(*bufpp), (*bufpp) = 0)
 393  385  
 394  386  /*
 395  387   * The nss_XbyY_args_t struct contains all the information passed between
↓ open down ↓ 50 lines elided ↑ open up ↑
 446  438          } pkey;
 447  439          struct {
 448  440                  const char      *name;
 449  441                  int             af_family;
 450  442                  int             flags;
 451  443          }       ipnode;
 452  444          void *attrp;    /* for the new attr databases */
 453  445  } nss_XbyY_key_t;
 454  446  
 455  447  
 456      -#if defined(__STDC__)
 457  448  typedef int             (*nss_key2str_t)(void *buffer, size_t buflen,
 458  449                                  nss_XbyY_key_t *key, size_t *len);
 459      -#else
 460      -typedef int             (*nss_key2str_t)();
 461      -#endif
 462  450  
 463  451  
 464  452  typedef struct nss_XbyY_args {
 465  453  
 466  454  /* IN */
 467  455          nss_XbyY_buf_t  buf;
 468  456          int             stayopen;
 469  457                          /*
 470  458                           * Support for setXXXent(stayopen)
 471  459                           * Used only in hosts, protocols,
↓ open down ↓ 210 lines elided ↑ open up ↑
 682  670          (str)->erange    = 0)
 683  671  
 684  672  #define NSS_XbyY_FINI(str)                              (\
 685  673          (str)->returnval == 0 && (str)->erange && (errno = ERANGE), \
 686  674          (str)->returnval)
 687  675  
 688  676  #define NSS_PACKED_CRED_CHECK(buf, ruid, euid)          (\
 689  677          ((nss_pheader_t *)(buf))->p_ruid == (ruid) && \
 690  678          ((nss_pheader_t *)(buf))->p_euid == (euid))
 691  679  
 692      -#if defined(__STDC__)
 693  680  extern char             **_nss_netdb_aliases(const char *, int, char *, int);
 694  681  extern nss_status_t     nss_default_key2str(void *, size_t, nss_XbyY_args_t *,
 695  682                                          const char *, int, size_t *);
 696  683  extern nss_status_t     nss_packed_arg_init(void *, size_t, nss_db_root_t *,
 697  684                                          nss_db_initf_t *, int *,
 698  685                                          nss_XbyY_args_t *);
 699  686  extern nss_status_t     nss_packed_context_init(void *, size_t, nss_db_root_t *,
 700  687                                          nss_db_initf_t *, nss_getent_t **,
 701  688                                          nss_XbyY_args_t *);
 702  689  extern void             nss_packed_set_status(void *, size_t, nss_status_t,
 703  690                                          nss_XbyY_args_t *);
 704  691  extern nss_status_t     nss_packed_getkey(void *, size_t, char **, int *,
 705  692                                          nss_XbyY_args_t *);
 706      -#else
 707      -extern char             **_nss_netdb_aliases();
 708      -extern int              nss_default_key2str();
 709      -extern nss_status_t     nss_packed_arg_init();
 710      -extern nss_status_t     nss_packed_context_init();
 711      -extern void             nss_packed_set_status();
 712      -extern nss_status_t     nss_packed_getkey();
 713      -#endif
 714  693  
 715  694  /*
 716  695   * nss_dbop_t values for searches with various keys;  values for
 717  696   * destructor/endent/setent/getent are defined in <nss_common.h>
 718  697   */
 719  698  
 720  699  /*
 721  700   * These are part of the "Over the wire" IE app->nscd getXbyY
 722  701   * op for well known getXbyY's.  Cannot use NSS_DBOP_X_Y directly
 723  702   * because NSS_DBOP_next_iter is NOT an incrementing counter value
↓ open down ↓ 122 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX