Lines Matching +full:user +full:- +full:defined
2 * Copyright (c) 2001-2003,2009 Proofpoint, Inc. and its suppliers.
11 SM_RCSID("@(#)$Id: mbdb.c,v 1.43 2014-01-08 17:03:15 ca Exp $")
40 int (*mbdb_lookup) __P((char *name, SM_MBDB_T *user));
45 static int mbdb_pw_lookup __P((char *name, SM_MBDB_T *user));
51 static int mbdb_ldap_lookup __P((char *name, SM_MBDB_T *user));
67 ** SM_MBDB_INITIALIZE -- specify which mailbox database to use
73 ** mbdb -- Which mailbox database to use.
99 namelen = arg - name;
103 for (t = SmMbdbTypes; t->mbdb_typename != NULL; ++t)
105 if (strlen(t->mbdb_typename) == namelen &&
106 strncmp(name, t->mbdb_typename, namelen) == 0)
109 if (t->mbdb_initialize != NULL)
110 err = t->mbdb_initialize(arg);
120 ** SM_MBDB_TERMINATE -- terminate connection to the mailbox database
137 if (SmMbdbType->mbdb_terminate != NULL) in sm_mbdb_terminate()
138 SmMbdbType->mbdb_terminate(); in sm_mbdb_terminate()
142 ** SM_MBDB_LOOKUP -- look up a local mail recipient, given name
145 ** name -- name of local mail recipient
146 ** user -- pointer to structure to fill in on success
149 ** On success, fill in *user and return EX_OK.
150 ** If the user does not exist, return EX_NOUSER.
156 sm_mbdb_lookup(name, user) in sm_mbdb_lookup() argument
158 SM_MBDB_T *user;
162 if (SmMbdbType->mbdb_lookup != NULL)
163 ret = SmMbdbType->mbdb_lookup(name, user);
168 ** SM_MBDB_FROMPW -- copy from struct pw to SM_MBDB_T
171 ** user -- destination user information structure
172 ** pw -- source passwd structure
179 sm_mbdb_frompw(user, pw) in sm_mbdb_frompw() argument
180 SM_MBDB_T *user; in sm_mbdb_frompw()
183 SM_REQUIRE(user != NULL);
184 (void) sm_strlcpy(user->mbdb_name, pw->pw_name,
185 sizeof(user->mbdb_name));
186 user->mbdb_uid = pw->pw_uid;
187 user->mbdb_gid = pw->pw_gid;
188 sm_pwfullname(pw->pw_gecos, pw->pw_name, user->mbdb_fullname,
189 sizeof(user->mbdb_fullname));
190 (void) sm_strlcpy(user->mbdb_homedir, pw->pw_dir,
191 sizeof(user->mbdb_homedir));
192 (void) sm_strlcpy(user->mbdb_shell, pw->pw_shell,
193 sizeof(user->mbdb_shell));
197 ** SM_PWFULLNAME -- build full name of user from pw_gecos field.
203 ** gecos -- name to build.
204 ** user -- the login name of this user (for &).
205 ** buf -- place to put the result.
206 ** buflen -- length of buf.
227 sm_pwfullname(gecos, user, buf, buflen) in sm_pwfullname() argument
229 char *user;
242 if (bp >= &buf[buflen - 1])
244 /* buffer overflow -- just use login name */
245 (void) sm_strlcpy(buf, user, buflen);
251 (void) sm_strlcpy(bp, user, buflen - (bp - buf));
259 *bp++ = Latin1ToASCII[(unsigned char) *p - 128];
274 ** MBDB_PW_INITIALIZE -- initialize getpwnam() version
277 ** arg -- unused.
292 ** MBDB_PW_LOOKUP -- look up a local mail recipient, given name
295 ** name -- name of local mail recipient
296 ** user -- pointer to structure to fill in on success
299 ** On success, fill in *user and return EX_OK.
304 mbdb_pw_lookup(name, user) in mbdb_pw_lookup() argument
306 SM_MBDB_T *user;
311 /* DEC Hesiod getpwnam accepts numeric strings -- short circuit it */
330 ** user unknown <-> getpwnam() == NULL && errno == 0
340 sm_mbdb_frompw(user, pw);
345 ** MBDB_PW_TERMINATE -- terminate connection to the mailbox database
366 ** DESC 'An integer uniquely identifying a user in an
368 ** EQUALITY integerMatch SYNTAX 'INTEGER' SINGLE-VALUE )
373 ** EQUALITY integerMatch SYNTAX 'INTEGER' SINGLE-VALUE )
379 ** SYNTAX 'IA5String' SINGLE-VALUE )
384 ** SYNTAX 'IA5String' SINGLE-VALUE )
389 ** SYNTAX 'IA5String' SINGLE-VALUE )
413 ** MBDB_LDAP_INITIALIZE -- initialize LDAP version
416 ** arg -- LDAP specification
459 ** MBDB_LDAP_LOOKUP -- look up a local mail recipient, given name
462 ** name -- name of local mail recipient
463 ** user -- pointer to structure to fill in on success
466 ** On success, fill in *user and return EX_OK.
477 mbdb_ldap_lookup(name, user) in mbdb_ldap_lookup() argument
479 SM_MBDB_T *user;
489 if (strlen(name) >= sizeof(user->mbdb_name))
504 /* re-open map in this child process */
517 if (msgid == -1)
578 # if !defined(LDAP_VERSION_MAX) && !defined(LDAP_OPT_SIZELIMIT)
585 LDAPLMAP.ldap_ld->ld_errno = LDAP_SUCCESS;
586 # endif /* !defined(LDAP_VERSION_MAX) !defined(LDAP_OPT_SIZELIMIT) */
612 # if !defined(LDAP_VERSION_MAX) && !defined(LDAP_OPT_SIZELIMIT)
619 LDAPLMAP.ldap_ld->ld_errno = LDAP_SUCCESS;
620 # endif /* !defined(LDAP_VERSION_MAX) !defined(LDAP_OPT_SIZELIMIT) */
628 strlen(vals[0]) >= sizeof(user->mbdb_fullname))
631 sm_pwfullname(vals[0], name, user->mbdb_fullname,
632 sizeof(user->mbdb_fullname));
638 strlen(vals[0]) >= sizeof(user->mbdb_homedir))
641 (void) sm_strlcpy(user->mbdb_homedir, vals[0],
642 sizeof(user->mbdb_homedir));
648 strlen(vals[0]) >= sizeof(user->mbdb_shell))
651 (void) sm_strlcpy(user->mbdb_shell, vals[0],
652 sizeof(user->mbdb_shell));
665 if (p == vals[0] && *p == '-')
667 /* but not simply '-' */
674 user->mbdb_uid = atoi(vals[0]);
687 if (p == vals[0] && *p == '-')
689 /* but not simply '-' */
696 user->mbdb_gid = atoi(vals[0]);
713 ** http://www.openldap.org/lists/openldap-devel/9901/msg00064.html
741 (void) sm_strlcpy(user->mbdb_name, name,
742 sizeof(user->mbdb_name));
756 ** MBDB_LDAP_TERMINATE -- terminate connection to the mailbox database