Back to index

courier  0.68.2
Defines | Functions
ldapaliasdrc.h File Reference
#include "config.h"
#include <stdio.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define LDAPALIASDCONFIGFILE   SYSCONFDIR "/ldapaliasrc"
#define SOCKETFILE   LOCALSTATEDIR "/tmp/ldapaliasd"
#define LOCKFILE   LOCALSTATEDIR "/tmp/ldapaliasd.lock"
#define PIDFILE   LOCALSTATEDIR "/tmp/ldapaliasd.pid"

Functions

const char * ldapaliasd_config (const char *)
FILE * ldapaliasd_connect ()
void ldapaliasd_configchanged ()

Define Documentation

#define LDAPALIASDCONFIGFILE   SYSCONFDIR "/ldapaliasrc"

Definition at line 22 of file ldapaliasdrc.h.

#define LOCKFILE   LOCALSTATEDIR "/tmp/ldapaliasd.lock"

Definition at line 24 of file ldapaliasdrc.h.

#define PIDFILE   LOCALSTATEDIR "/tmp/ldapaliasd.pid"

Definition at line 25 of file ldapaliasdrc.h.

#define SOCKETFILE   LOCALSTATEDIR "/tmp/ldapaliasd"

Definition at line 23 of file ldapaliasdrc.h.


Function Documentation

const char* ldapaliasd_config ( const char *  )

Definition at line 91 of file ldapaliasdrc.c.

{
       size_t i;
       int    l=strlen(configname);
       char   *p=0;

       if (!ldapauth && readconfigfile())
              return ("");

       for (i=0; i<ldapauth_size; )
       {
              p=ldapauth+i;
              if (memcmp(p, configname, l) == 0 &&
                     isspace((int)(unsigned char)p[l]))
              {
                     p += l;
                     while (*p && *p != '\n' &&
                            isspace((int)(unsigned char)*p))
                            ++p;
                     return (p);
              }

              while (i < ldapauth_size)
                     if (ldapauth[i++] == 0)     break;
       }

       return ("");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 81 of file ldapaliasdrc.c.

{
       if (ldapauth)
       {
              free(ldapauth);
              ldapauth=0;
              ldapauth_size=0;
       }
}

Here is the caller graph for this function:

FILE* ldapaliasd_connect ( )

Definition at line 120 of file ldapaliasdrc.c.

{
       int     fd=socket(PF_UNIX, SOCK_STREAM, 0);
       struct  sockaddr_un skun;
       FILE   *fp;

        if (fd < 0)
       {
              return (NULL);
       }

        skun.sun_family=AF_UNIX;
        strcpy(skun.sun_path, SOCKETFILE);

       if (connect(fd, (const struct sockaddr *)&skun, sizeof(skun)) < 0)
       {
              close(fd);
              return (NULL);
       }

       fp=fdopen(fd, "r+");

       if (!fp)
       {
              close(fd);
              syslog(LOG_DAEMON | LOG_CRIT, "fdopen() failed; %m");
              return (NULL);
       }
       return (fp);
}

Here is the caller graph for this function: