]> git.sur5r.net Git - openldap/blob - libraries/libldap/addentry.c
Renamed ppcontrol.c to ppolicy.c
[openldap] / libraries / libldap / addentry.c
1 /* addentry.c */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 1998-2004 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in the file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16 /* Portions Copyright (c) 1990 Regents of the University of Michigan.
17  * All rights reserved.
18  */
19
20 #include "portable.h"
21
22 #include <stdio.h>
23
24 #include <ac/stdlib.h>
25
26 #include <ac/socket.h>
27 #include <ac/string.h>
28 #include <ac/time.h>
29
30 #include "ldap-int.h"
31
32 LDAPMessage *
33 ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e )
34 {
35         LDAPMessage     *tmp, *prev = NULL;
36
37         assert( list != NULL );
38         assert( e != NULL );
39
40         for ( tmp = *list; tmp != NULL && tmp != e; tmp = tmp->lm_chain )
41                 prev = tmp;
42
43         if ( tmp == NULL )
44                 return( NULL );
45
46         if ( prev == NULL )
47                 *list = tmp->lm_chain;
48         else
49                 prev->lm_chain = tmp->lm_chain;
50         tmp->lm_chain = NULL;
51
52         return( tmp );
53 }
54
55 void
56 ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e )
57 {
58         assert( list != NULL );
59         assert( e != NULL );
60
61         e->lm_chain = *list;
62         *list = e;
63 }