Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nss
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2006-11-26 13:01:49 +0100
committerArthur de Jong <arthur@arthurdejong.org>2006-11-26 13:01:49 +0100
commit16be7ee5d30c8bce08f32563c4fa846a6928aed4 (patch)
treec733f223e6bf7a008991307dd30999a7df3aa110 /nss
parent70f10e2b6c10e7e47ab3377854e61a4534af79fb (diff)
get rid of automount map information lookups through NSS as this is not used (at least not with glibc), autofs-ldap looks up the information on it's own (but does parse /etc/nsswitch.conf)
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/libnss_ldapd@124 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nss')
-rw-r--r--nss/Makefile.am6
-rw-r--r--nss/automount.c170
-rw-r--r--nss/prototypes.h6
3 files changed, 3 insertions, 179 deletions
diff --git a/nss/Makefile.am b/nss/Makefile.am
index 5211caf..f128466 100644
--- a/nss/Makefile.am
+++ b/nss/Makefile.am
@@ -22,6 +22,6 @@ noinst_LIBRARIES = libnss.a
libnss_a_SOURCES = common.c common.h prototypes.h ../nslcd-client.h \
../nslcd.h ../nslcd-common.h \
- aliases.c automount.c ethers.c group.c hosts.c \
- netgroup.c networks.c passwd.c protocols.c rpc.c \
- services.c shadow.c
+ aliases.c ethers.c group.c hosts.c netgroup.c \
+ networks.c passwd.c protocols.c rpc.c services.c \
+ shadow.c
diff --git a/nss/automount.c b/nss/automount.c
deleted file mode 100644
index 1297330..0000000
--- a/nss/automount.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- automount.c - NSS lookup functions for automounter maps
-
- Copyright (C) 2006 West Consulting
- Copyright (C) 2006 Arthur de Jong
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA
-*/
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <nss.h>
-#include <errno.h>
-
-#include "prototypes.h"
-#include "nslcd-client.h"
-#include "common.h"
-
-/* macros for expanding the LDF_AUTOMOUNT macro */
-#define LDF_STRING(field) READ_STRING_BUF(fp,field)
-#define AUTOMOUNT_KEY *canon_key
-#define AUTOMOUNT_INFO *value
-
-#define AUTOMOUNT_CONTEXT_MAGIC 0x83451830
-
-struct automount_context
-{
- char *mapname;
- FILE *fp; /* for getautomntent() call */
- int32_t magic; /* for sanity checks */
-};
-
-static enum nss_status read_automount(
- FILE *fp,const char **canon_key,const char **value,
- char *buffer,size_t buflen,int *errnop)
-{
- int32_t tmpint32;
- size_t bufptr=0;
- /* auto-genereted read code */
- LDF_AUTOMOUNT;
- /* we're done */
- return NSS_STATUS_SUCCESS;
-}
-
-/* this function initiates a structure for doing queries
- using getautomountbyname() and getautomountent() */
-enum nss_status _nss_ldap_setautomntent(
- const char *mapname,void **private)
-{
- struct automount_context *context;
- /* allocate memory */
- context=malloc(sizeof(struct automount_context));
- if (context==NULL)
- return NSS_STATUS_UNAVAIL;
- /* store mapname */
- context->mapname=strdup(mapname);
- if (context->mapname==NULL)
- {
- free(context);
- return NSS_STATUS_UNAVAIL;
- }
- /* clear file handle and store magic */
- context->fp=NULL;
- context->magic=AUTOMOUNT_CONTEXT_MAGIC;
- /* return context */
- *private=context;
- return NSS_STATUS_SUCCESS;
-}
-
-/* this searches for an automounter key within the automounter
- map initialized by setautomountent() */
-enum nss_status _nss_ldap_getautomntbyname_r(
- void *private,const char *key,const char **canon_key,
- const char **value,char *buffer,size_t buflen,int *errnop)
-{
- struct automount_context *context;
- FILE *fp;
- int32_t tmpint32;
- enum nss_status retv;
- /* check context */
- context=(struct automount_context *)private;
- if ((context==NULL)||(context->magic!=AUTOMOUNT_CONTEXT_MAGIC))
- return NSS_STATUS_UNAVAIL;
- /* open socket and write request */
- OPEN_SOCK(fp);
- WRITE_REQUEST(fp,NSLCD_ACTION_AUTOMOUNT_BYNAME);
- WRITE_STRING(fp,context->mapname);
- WRITE_STRING(fp,key);
- WRITE_FLUSH(fp);
- /* read response header */
- READ_RESPONSEHEADER(fp,NSLCD_ACTION_AUTOMOUNT_BYNAME);
- /* read response */
- READ_RESPONSE_CODE(fp);
- retv=read_automount(fp,canon_key,value,buffer,buflen,errnop);
- if (retv!=NSS_STATUS_SUCCESS)
- return retv;
- /* close socket and we're done */
- fclose(fp);
- return NSS_STATUS_SUCCESS;
-}
-
-enum nss_status _nss_ldap_getautomntent_r(
- void *private,const char **canon_key,const char **value,
- char *buffer,size_t buflen,int *errnop)
-{
- struct automount_context *context;
- int32_t tmpint32;
- enum nss_status retv;
- /* check context */
- context=(struct automount_context *)private;
- if ((context==NULL)||(context->magic!=AUTOMOUNT_CONTEXT_MAGIC))
- return NSS_STATUS_UNAVAIL;
- /* if we don't have a file descriptor, begin a request now */
- if (context->fp==NULL)
- {
- /* open a new stream and write the request */
- OPEN_SOCK(context->fp);
- WRITE_REQUEST(context->fp,NSLCD_ACTION_AUTOMOUNT_ALL);
- WRITE_FLUSH(context->fp);
- /* read response header */
- READ_RESPONSEHEADER(context->fp,NSLCD_ACTION_AUTOMOUNT_ALL);
- }
- /* read a response */
- READ_RESPONSE_CODE(context->fp);
- retv=read_automount(context->fp,canon_key,value,buffer,buflen,errnop);
- if (retv!=NSS_STATUS_SUCCESS)
- {
- /* remove reference to fp from context */
- context->fp=NULL;
- return retv;
- }
- return NSS_STATUS_SUCCESS;
-}
-
-enum nss_status _nss_ldap_endautomntent(void **private)
-{
- struct automount_context *context;
- /* check private */
- if (private==NULL)
- return NSS_STATUS_UNAVAIL;
- /* check context */
- context=(struct automount_context *)*private;
- if ((context==NULL)||(context->magic!=AUTOMOUNT_CONTEXT_MAGIC))
- return NSS_STATUS_UNAVAIL;
- /* close any connections */
- if (context->fp!=NULL)
- fclose(context->fp);
- /* free memory */
- free(context->mapname);
- free(context);
- /* invalidate reference */
- *private=NULL;
- /* we're done */
- return NSS_STATUS_SUCCESS;
-}
diff --git a/nss/prototypes.h b/nss/prototypes.h
index a00154e..39d4453 100644
--- a/nss/prototypes.h
+++ b/nss/prototypes.h
@@ -89,12 +89,6 @@ enum nss_status _nss_ldap_setaliasent(void);
enum nss_status _nss_ldap_getaliasent_r(struct aliasent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_endaliasent(void);
-/* automount - automounter maps */
-enum nss_status _nss_ldap_setautomntent(const char *mapname,void **private);
-enum nss_status _nss_ldap_getautomntbyname_r(void *private,const char *key,const char **canon_key,const char **value,char *buffer,size_t buflen,int *errnop);
-enum nss_status _nss_ldap_getautomntent_r(void *private,const char **canon_key,const char **value,char *buffer,size_t buflen,int *errnop);
-enum nss_status _nss_ldap_endautomntent(void **private);
-
/* ethers - ethernet numbers */
enum nss_status _nss_ldap_gethostton_r(const char *name,struct etherent *resut,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_getntohost_r(const struct ether_addr *addr,struct etherent *eth,char *buffer,size_t buflen,int *errnop);