1 /* abandon.c - decode and handle an ldap abandon operation */
4 * Copyright (c) 1995 Regents of the University of Michigan.
7 * Redistribution and use in source and binary forms are permitted
8 * provided that this notice is preserved and that due credit is given
9 * to the University of Michigan at Ann Arbor. The name of the University
10 * may not be used to endorse or promote products derived from this
11 * software without specific prior written permission. This software
12 * is provided ``as is'' without express or implied warranty.
18 #include <ac/socket.h>
33 Debug( LDAP_DEBUG_TRACE, "do_abandon\n", 0, 0, 0 );
36 * Parse the abandon request. It looks like this:
38 * AbandonRequest := MessageID
41 if ( ber_scanf( op->o_ber, "i", &id ) == LBER_ERROR ) {
42 Debug( LDAP_DEBUG_ANY, "do_abandon: ber_scanf failed\n", 0, 0 ,0 );
43 return LDAP_PROTOCOL_ERROR;
47 if( (rc = get_ctrls( conn, op, 0 )) != LDAP_SUCCESS ) {
48 Debug( LDAP_DEBUG_ANY, "do_abandon: get_ctrls failed\n", 0, 0 ,0 );
53 Debug( LDAP_DEBUG_ARGS, "do_abandon: id %d\n", id, 0 ,0 );
56 * find the operation being abandoned and set the o_abandon
57 * flag. It's up to the backend to periodically check this
58 * flag and abort the operation at a convenient time.
61 ldap_pvt_thread_mutex_lock( &conn->c_mutex );
63 for ( o = conn->c_ops; o != NULL; o = o->o_next ) {
64 if ( o->o_msgid == id ) {
65 ldap_pvt_thread_mutex_lock( &o->o_abandonmutex );
67 ldap_pvt_thread_mutex_unlock( &o->o_abandonmutex );
73 for ( oo = &conn->c_pending_ops;
74 (*oo != NULL) && ((*oo)->o_msgid != id);
88 Debug( LDAP_DEBUG_TRACE, "do_abandon: op not found\n", 0, 0, 0 );
91 ldap_pvt_thread_mutex_unlock( &conn->c_mutex );