1 /* modrdn.c - shell backend modrdn function */
4 * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
9 * LDAP v3 newSuperior support.
11 * Copyright 1999, Juan C. Gomez, All rights reserved.
12 * This software is not subject to any license of Silicon Graphics
13 * Inc. or Purdue University.
15 * Redistribution and use in source and binary forms are permitted
16 * without restriction or fee of any kind as long as this notice
25 #include <ac/socket.h>
26 #include <ac/string.h>
38 struct berval *newrdn,
39 struct berval *nnewrdn,
41 struct berval *newSuperior,
42 struct berval *nnewSuperior
45 struct shellinfo *si = (struct shellinfo *) be->be_private;
48 if ( si->si_modrdn == NULL ) {
49 send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
50 "modrdn not implemented", NULL, NULL );
54 if ( (op->o_private = (void *) forkandexec( si->si_modrdn, &rfp, &wfp ))
56 send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
57 "could not fork/exec", NULL, NULL );
61 /* write out the request to the modrdn process */
62 fprintf( wfp, "MODRDN\n" );
63 fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
64 print_suffixes( wfp, be );
65 fprintf( wfp, "dn: %s\n", dn->bv_val );
66 fprintf( wfp, "newrdn: %s\n", newrdn->bv_val );
67 fprintf( wfp, "deleteoldrdn: %d\n", deleteoldrdn ? 1 : 0 );
68 if (newSuperior != NULL) {
69 fprintf( wfp, "newSuperior: %s\n", newSuperior->bv_val );
73 /* read in the results and send them along */
74 read_and_send_results( be, conn, op, rfp, NULL, 0 );