Blame compat/nss_compat.h

Packit 6bd9ab
/*
Packit 6bd9ab
   nss_compat.h - compatibility definitions for NSS functions
Packit 6bd9ab
Packit 6bd9ab
   Copyright (C) 2010, 2012 Arthur de Jong
Packit 6bd9ab
   Copyright (C) 2010 Symas Corporation
Packit 6bd9ab
Packit 6bd9ab
   This library is free software; you can redistribute it and/or
Packit 6bd9ab
   modify it under the terms of the GNU Lesser General Public
Packit 6bd9ab
   License as published by the Free Software Foundation; either
Packit 6bd9ab
   version 2.1 of the License, or (at your option) any later version.
Packit 6bd9ab
Packit 6bd9ab
   This library is distributed in the hope that it will be useful,
Packit 6bd9ab
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6bd9ab
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6bd9ab
   Lesser General Public License for more details.
Packit 6bd9ab
Packit 6bd9ab
   You should have received a copy of the GNU Lesser General Public
Packit 6bd9ab
   License along with this library; if not, write to the Free Software
Packit 6bd9ab
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Packit 6bd9ab
   02110-1301 USA
Packit 6bd9ab
*/
Packit 6bd9ab
Packit 6bd9ab
#ifndef COMPAT__NSS_H
Packit 6bd9ab
#define COMPAT__NSS_H 1
Packit 6bd9ab
Packit 6bd9ab
#ifdef HAVE_NSS_H
Packit 6bd9ab
#include <nss.h>
Packit 6bd9ab
#endif /* HAVE_NSS_H */
Packit 6bd9ab
#ifdef HAVE_NSS_COMMON_H
Packit 6bd9ab
#include <nss_common.h>
Packit 6bd9ab
#endif /* HAVE_NSS_COMMON_H */
Packit 6bd9ab
#ifdef HAVE_ALIASES_H
Packit 6bd9ab
#include <aliases.h>
Packit 6bd9ab
#endif
Packit 6bd9ab
#include <sys/socket.h>
Packit 6bd9ab
#include <sys/types.h>
Packit 6bd9ab
#include <grp.h>
Packit 6bd9ab
#include <netdb.h>
Packit 6bd9ab
#include <pwd.h>
Packit 6bd9ab
#ifdef HAVE_SHADOW_H
Packit 6bd9ab
#include <shadow.h>
Packit 6bd9ab
#endif /* HAVE_SHADOW_H */
Packit 6bd9ab
#ifdef HAVE_RPC_RPCENT_H
Packit 6bd9ab
#include <rpc/rpcent.h>
Packit 6bd9ab
#endif /* HAVE_RPC_RPCENT_H */
Packit 6bd9ab
#ifdef HAVE_NSS_DBDEFS_H
Packit 6bd9ab
#include <nss_dbdefs.h>
Packit 6bd9ab
#endif /* HAVE_NSS_DBDEFS_H */
Packit 6bd9ab
#ifdef HAVE_NSSWITCH_H
Packit 6bd9ab
#include <nsswitch.h>
Packit 6bd9ab
#endif /* HAVE_NSSWITCH_H */
Packit 6bd9ab
Packit 6bd9ab
#include "compat/ether.h"
Packit 6bd9ab
Packit 6bd9ab
/* define missing status codes */
Packit 6bd9ab
#ifndef HAVE_ENUM_NSS_STATUS
Packit 6bd9ab
#ifndef NSS_STATUS_SUCCESS
Packit 6bd9ab
#define NSS_STATUS_SUCCESS NSS_SUCCESS
Packit 6bd9ab
#endif
Packit 6bd9ab
#ifndef NSS_STATUS_NOTFOUND
Packit 6bd9ab
#define NSS_STATUS_NOTFOUND NSS_NOTFOUND
Packit 6bd9ab
#endif
Packit 6bd9ab
#ifndef NSS_STATUS_UNAVAIL
Packit 6bd9ab
#define NSS_STATUS_UNAVAIL NSS_UNAVAIL
Packit 6bd9ab
#endif
Packit 6bd9ab
#ifndef NSS_STATUS_TRYAGAIN
Packit 6bd9ab
#define NSS_STATUS_TRYAGAIN NSS_TRYAGAIN
Packit 6bd9ab
#endif
Packit 6bd9ab
#ifndef NSS_STATUS_RETURN
Packit 6bd9ab
#define NSS_STATUS_RETURN NSS_NOTFOUND
Packit 6bd9ab
#endif
Packit 6bd9ab
#endif /* not HAVE_ENUM_NSS_STATUS */
Packit 6bd9ab
Packit 6bd9ab
/* define nss_status_t */
Packit 6bd9ab
#ifdef HAVE_ENUM_NSS_STATUS
Packit 6bd9ab
typedef enum nss_status nss_status_t;
Packit 6bd9ab
#endif
Packit 6bd9ab
Packit 6bd9ab
/* Define an aliasent if it was not found on the system. */
Packit 6bd9ab
#ifndef HAVE_STRUCT_ALIASENT
Packit 6bd9ab
struct aliasent {
Packit 6bd9ab
  char *alias_name;
Packit 6bd9ab
  size_t alias_members_len;
Packit 6bd9ab
  char **alias_members;
Packit 6bd9ab
  int alias_local;
Packit 6bd9ab
};
Packit 6bd9ab
#endif /* not HAVE_STRUCT_ALIASENT */
Packit 6bd9ab
Packit 6bd9ab
/* Define an rpcent if it was not found on the system */
Packit 6bd9ab
#ifndef HAVE_STRUCT_RPCENT
Packit 6bd9ab
struct rpcent {
Packit 6bd9ab
  char *r_name;
Packit 6bd9ab
  char **r_aliases;
Packit 6bd9ab
  int r_number;
Packit 6bd9ab
};
Packit 6bd9ab
#endif /* not HAVE_STRUCT_RPCENT */
Packit 6bd9ab
Packit 6bd9ab
/* We define struct etherent here because it does not seem to
Packit 6bd9ab
   be defined in any publicly available header file exposed
Packit 6bd9ab
   by glibc. This is taken from include/netinet/ether.h
Packit 6bd9ab
   of the glibc (2.3.6) source tarball. */
Packit 6bd9ab
#ifndef HAVE_STRUCT_ETHERENT
Packit 6bd9ab
struct etherent {
Packit 6bd9ab
  const char *e_name;
Packit 6bd9ab
  struct ether_addr e_addr;
Packit 6bd9ab
};
Packit 6bd9ab
#endif /* not HAVE_STRUCT_ETHERENT */
Packit 6bd9ab
Packit 6bd9ab
/* We also define struct __netgrent because its definition is
Packit 6bd9ab
   not publically available. This is taken from inet/netgroup.h
Packit 6bd9ab
   of the glibc (2.3.6) source tarball.
Packit 6bd9ab
   The first part of the struct is the only part that is modified
Packit 6bd9ab
   by our getnetgrent() function, all the other fields are not
Packit 6bd9ab
   touched at all. */
Packit 6bd9ab
struct __netgrent {
Packit 6bd9ab
  enum { triple_val, group_val } type;
Packit 6bd9ab
  union {
Packit 6bd9ab
    struct {
Packit 6bd9ab
      const char *host;
Packit 6bd9ab
      const char *user;
Packit 6bd9ab
      const char *domain;
Packit 6bd9ab
    } triple;
Packit 6bd9ab
    const char *group;
Packit 6bd9ab
  } val;
Packit 6bd9ab
  /* the following stuff is used by some NSS services
Packit 6bd9ab
     but not by ours (it's not completely clear how these
Packit 6bd9ab
     are shared between different services) or is used
Packit 6bd9ab
     by our caller */
Packit 6bd9ab
  char *data;
Packit 6bd9ab
  size_t data_size;
Packit 6bd9ab
  union {
Packit 6bd9ab
    char *cursor;
Packit 6bd9ab
    unsigned long int position;
Packit 6bd9ab
  } insertedname; /* added name to union to avoid warning */
Packit 6bd9ab
  int first;
Packit 6bd9ab
  struct name_list *known_groups;
Packit 6bd9ab
  struct name_list *needed_groups;
Packit 6bd9ab
  void *nip; /* changed from `service_user *nip' */
Packit 6bd9ab
};
Packit 6bd9ab
Packit 6bd9ab
/* Define struct spwd if it was not found on the system. */
Packit 6bd9ab
#ifndef HAVE_STRUCT_SPWD
Packit 6bd9ab
struct spwd {
Packit 6bd9ab
  char *sp_namp;
Packit 6bd9ab
  char *sp_pwdp;
Packit 6bd9ab
  long sp_lstchg;
Packit 6bd9ab
  long sp_min;
Packit 6bd9ab
  long sp_max;
Packit 6bd9ab
  long sp_warn;
Packit 6bd9ab
  long sp_inact;
Packit 6bd9ab
  long sp_expire;
Packit 6bd9ab
  unsigned long sp_flag;
Packit 6bd9ab
};
Packit 6bd9ab
#endif /* not HAVE_STRUCT_SPWD */
Packit 6bd9ab
Packit 6bd9ab
#endif /* not COMPAT__NSS_H */