static int print_preread( LDAP *ld, LDAPControl *ctrl );
 static int print_postread( LDAP *ld, LDAPControl *ctrl );
 static int print_paged_results( LDAP *ld, LDAPControl *ctrl );
+#ifdef LDAP_CONTROL_AUTHZID_RESPONSE
+static int print_authzid( LDAP *ld, LDAPControl *ctrl );
+#endif
 #ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
 static int print_ppolicy( LDAP *ld, LDAPControl *ctrl );
 #endif
        { LDAP_CONTROL_PRE_READ,                        TOOL_ALL,       print_preread },
        { LDAP_CONTROL_POST_READ,                       TOOL_ALL,       print_postread },
        { LDAP_CONTROL_PAGEDRESULTS,                    TOOL_SEARCH,    print_paged_results },
+#ifdef LDAP_CONTROL_AUTHZID_RESPONSE
+       /* this is generally deprecated in favor of LDAP WhoAmI? operation, hence only supported as a VC inner control */
+       { LDAP_CONTROL_PASSWORDPOLICYRESPONSE,          TOOL_VC,        print_authzid },
+#endif
 #ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
        { LDAP_CONTROL_PASSWORDPOLICYRESPONSE,          TOOL_ALL,       print_ppolicy },
 #endif
 }
 #endif
 
+#ifdef LDAP_CONTROL_AUTHZID_RESPONSE
+static int
+print_authzid( LDAP *ld, LDAPControl *ctrl )
+{
+    if (ctrl->ldctl_value.bv_len) {
+           tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
+                   "authzid", ctrl->ldctl_value.bv_val,  ctrl->ldctl_value.bv_len );
+       } else {
+           tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
+                   "authzid", "anonymous",  sizeof("anonymous")-1);
+       }
+}
+#endif
+
 #ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
 static int
 print_ppolicy( LDAP *ld, LDAPControl *ctrl )
 
 
 #include "common.h"
 
+static int req_authzid = 0;
+static int req_pp = 0;
+
 static char * mech = NULL;
 static char * dn = NULL;
 static struct berval cred = {0, NULL};
        fprintf( stderr, _("    DN\tDistinguished Name\n"));
        fprintf( stderr, _("    cred\tCredentials (prompt if not present)\n"));
        fprintf( stderr, _("options:\n"));
+       fprintf( stderr, _("    -a\tRequest AuthzId\n"));
+       fprintf( stderr, _("    -b\tRequest Password Policy Information\n"));
        fprintf( stderr, _("    -S mech\tSASL mechanism (default "" e.g. Simple)\n"));
        tool_common_usage();
        exit( EXIT_FAILURE );
 }
 
 
-const char options[] = "S"
+const char options[] = "abS:"
        "d:D:e:h:H:InNO:o:p:QR:U:vVw:WxX:y:Y:Z";
 
 int
                usage();
 #endif
 
+       case 'a':  /* request authzid */
+               req_authzid++;
+               break;
+
+       case 'b':  /* request authzid */
+               req_pp++;
+               break;
+
        case 'S':  /* SASL mechanism */
                mech = optarg;
                break;
        int             id, code = 0;
        LDAPMessage     *res;
        LDAPControl     **ctrls = NULL;
+       LDAPControl     **vcctrls = NULL;
+       int nvcctrls = 0;
 
        tool_init( TOOL_VC );
        prog = lutil_progname( "ldapvc", argc, argv );
 
        tool_server_controls( ld, NULL, 0 );
 
+    if (req_authzid) {
+               vcctrls = (LDAPControl **) malloc(3*sizeof(LDAPControl *));
+               vcctrls[nvcctrls] = (LDAPControl *) malloc(sizeof(LDAPControl));
+               vcctrls[nvcctrls]->ldctl_oid = LDAP_CONTROL_AUTHZID_REQUEST;
+               vcctrls[nvcctrls]->ldctl_iscritical = 0;
+               vcctrls[nvcctrls]->ldctl_value.bv_val = NULL;
+               vcctrls[nvcctrls]->ldctl_value.bv_len = 0;
+               vcctrls[++nvcctrls] = NULL;
+    }
+
+    if (req_pp) {
+               if (vcctrls) vcctrls = (LDAPControl **) malloc(3*sizeof(LDAPControl *));
+               vcctrls[nvcctrls] = (LDAPControl *) malloc(sizeof(LDAPControl));
+               vcctrls[nvcctrls]->ldctl_oid = LDAP_CONTROL_PASSWORDPOLICYREQUEST;
+               vcctrls[nvcctrls]->ldctl_iscritical = 0;
+               vcctrls[nvcctrls]->ldctl_value.bv_val = NULL;
+               vcctrls[nvcctrls]->ldctl_value.bv_len = 0;
+               vcctrls[++nvcctrls] = NULL;
+    }
+
        rc = ldap_verify_credentials( ld,
                NULL,
-               dn, mech, cred.bv_val ? &cred: NULL, NULL,
+               dn, mech, cred.bv_val ? &cred: NULL, vcctrls,
                NULL, NULL, &id ); 
 
        if( rc != LDAP_SUCCESS ) {
                goto skip;
        }
 
+       ldap_controls_free(vcctrls);
+       vcctrls = NULL;
+
        for ( ; ; ) {
                struct timeval  tv;
 
                goto skip;
        }
 
-       rc = ldap_parse_verify_credentials( ld, res, &rcode, &diag, &scookie, &scred, NULL );
+       rc = ldap_parse_verify_credentials( ld, res, &rcode, &diag, &scookie, &scred, &vcctrls );
        ldap_msgfree(res);
 
        if( rc != LDAP_SUCCESS ) {
            printf(_("Diagnostic: %s\n"), diag);
        }
 
-    /* print vc controls here (once added) */
+       if (vcctrls) {
+               tool_print_ctrls( ld, vcctrls );
+       }
 
 skip:
        if ( verbose || ( code != LDAP_SUCCESS ) ||