[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LUDI - Local User Data Interface



I'm planning to throw some function calls as described below all around
Zmailer source.  And add corresponding "--with..." parameter in configure.
Matti, can you look and see if you have any comments?  Maybe I am doing
something silly...

Thank you.

File "include/ludi.h":

====
#ifndef LUDI_H
#define LUDI_H

/*
  LUDI stands for "Local User Data Interface".  This is a library
  employing a few well-documented functions that are used throughout
  Zmailer to get various attributes of local users: struct passwd,
  mailbox quota, forwarding information.  (Another meaning for the
  name "ludi" is "people" in Russian :)

  It is assumed that a sysadmin who has a local database for the users
  that [s]he would like to use instead of /etc/passwd, ~/.forward etc.
  will write this interface library and specify it in configure. 
  Zmailer will check these functions before going for regular getpwnam()
  etc.

  This header must go after #include <pwd.h> in the .c files.

  Function prototypes follow.
*/

#ifdef __STDC__

/* ludi_getpwnam() accepts user name, "host" name as on routing result,
   and "user" part of routed data.  It should return a pointer to
   "struct passwd" that it must allocate in static memory.  If there
   is no such user in the database, the function should return NULL
   and set errno to zero.  If the function cannot determine the user
   attributes (e.g. because the database is inaccessible or malfunctioning),
   it should return NULL and set errno to some reasonable nonzero value.
   It is supposed that the function will behave reasonably if only usernam
   argument it passed and the other two are NULL. */

extern struct passwd *
        ludi_getpwnam(char *usernam, char *domain, char *fulladdr);

/* ludi_mbquota() accepts user name, "host" name as on routing result,
   "user" part of routed data, and current mailbox size.  It should
   return 0 if it is OK to write to the mailbox, or non-zero if `mailbox
   full' condition encountered.  */

extern int
        ludi_mbquota(char *usernam, char *domain, char *fulladdr, int size);

/* ludi_readdress() accepts original destination address.  It should
   return a pointer to a statically allocated character string
   containing comma-separated list of RFC822 addresses where to forward
   mail for this user.  Analog of ~/.forward but it is called by the
   router *before* validations of the local part, at the same time as
   fqdnaliases database is checked.  This allows to process full names
   and maybe other special cases thru this local database interface. */

extern char *
        ludi_readdress(char *fulladdr);

#else /* no prototypes */

extern struct passwd *ludi_getpwnam(char *, char *, char *);
extern int ludi_mbquota(char *, char *, char *, int);
extern char *ludi_readdress(char *);

#endif

#endif
====

Eugene