summaryrefslogtreecommitdiffstats
path: root/lib/ldaputil/utest/auth.cpp
blob: 46be3a2b3bec0e4e113eadf71b6874a29c59606e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
/** BEGIN COPYRIGHT BLOCK
 * This Program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; version 2 of the License.
 * 
 * This Program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA 02111-1307 USA.
 * 
 * In addition, as a special exception, Red Hat, Inc. gives You the additional
 * right to link the code of this Program with code not covered under the GNU
 * General Public License ("Non-GPL Code") and to distribute linked combinations
 * including the two, subject to the limitations in this paragraph. Non-GPL Code
 * permitted under this exception must only link to the code of this Program
 * through those well defined interfaces identified in the file named EXCEPTION
 * found in the source code files (the "Approved Interfaces"). The files of
 * Non-GPL Code may instantiate templates or use macros or inline functions from
 * the Approved Interfaces without causing the resulting work to be covered by
 * the GNU General Public License. Only Red Hat, Inc. may make changes or
 * additions to the list of Approved Interfaces. You must obey the GNU General
 * Public License in all respects for all of the Program code and other code used
 * in conjunction with the Program except the Non-GPL Code covered by this
 * exception. If you modify this file, you may extend this exception to your
 * version of the file, but you are not obligated to do so. If you do not wish to
 * provide this exception without modification, you must delete this exception
 * statement from your version and license this file solely under the GPL without
 * exception. 
 * 
 * 
 * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
 * Copyright (C) 2005 Red Hat, Inc.
 * All rights reserved.
 * END COPYRIGHT BLOCK **/

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif


#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

#include <prinit.h>		// for PR_Init
#include <prpriv.h>		// for PR_Exit
#include <ldaputil/certmap.h>
#include <ldaputil/init.h>
#include <ldaputil/ldapdb.h>
#include <ldaputil/ldapauth.h>
#include <ldaputil/dbconf.h>
#include <ldaputil/ldaputil.h>
#include <ldap.h>

static const char* dllname = "plugin.so";

char *global_issuer_dn = "o=" VENDOR ", c=US";

#define NSPR_INIT(Program) (PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 8))

static int ldapu_certinfo_save_test (const char *fname, const char *old_fname)
{
    int rv;

    /* Read the original certmap config file first */
    rv = ldaputil_init(old_fname, dllname, NULL, NULL, NULL);

    if (rv != LDAPU_SUCCESS) {
	fprintf(stderr, "ldapu_certinfo_save_test failed.  Reason: %s\n",
		ldapu_err2string(rv));
	return rv;
    }

    rv = ldapu_certinfo_save(fname, old_fname, "certmap.tmp");

    if (rv != LDAPU_SUCCESS) {
	fprintf(stderr, "ldapu_certinfo_save_test failed.  Reason: %s\n",
		ldapu_err2string(rv));
    }

    return rv;
}

static int ldapu_certinfo_delete_test (const char *fname, const char *old_fname)
{
    int rv;

    /* Read the original certmap config file first */
    rv = ldaputil_init(old_fname, dllname, NULL, NULL, NULL);

    if (rv != LDAPU_SUCCESS) {
	fprintf(stderr, "ldapu_certinfo_delete_test failed.  Reason: %s\n",
		ldapu_err2string(rv));
	return rv;
    }

    /* rv = ldapu_certinfo_delete("o=Ace Industry, c=US"); */
    rv = ldapu_certinfo_delete("o=" VENDOR ", c=US");

    if (rv != LDAPU_SUCCESS) {
	fprintf(stderr, "ldapu_certinfo_delete failed.  Reason: %s\n",
		ldapu_err2string(rv));
	return rv;
    }

    rv = ldapu_certinfo_save(fname, old_fname, "certmap.tmp");

    if (rv != LDAPU_SUCCESS) {
	fprintf(stderr, "ldapu_certinfo_delete_test failed.  Reason: %s\n",
		ldapu_err2string(rv));
    }

    return rv;
}

static int ldapu_certinfo_new_test (const char *fname, const char *old_fname)
{
    int rv;
    LDAPUPropValList_t *propval_list;
    LDAPUPropVal_t *propval;

    /* Read the original certmap config file first */
    rv = ldaputil_init(old_fname, dllname, NULL, NULL, NULL);

    if (rv != LDAPU_SUCCESS) {
	fprintf(stderr, "ldapu_certinfo_new_test failed.  Reason: %s\n",
		ldapu_err2string(rv));
	return rv;
    }

    /* Setup propval_list */
    rv = ldapu_list_alloc(&propval_list);
    if (rv != LDAPU_SUCCESS) return rv;

    rv = ldapu_propval_alloc("prop1", "val1", &propval);
    if (rv != LDAPU_SUCCESS) return rv;

    rv = ldapu_list_add_info(propval_list, propval);
    if (rv != LDAPU_SUCCESS) return rv;

    rv = ldapu_propval_alloc("prop2", "val2", &propval);
    if (rv != LDAPU_SUCCESS) return rv;

    rv = ldapu_list_add_info(propval_list, propval);
    if (rv != LDAPU_SUCCESS) return rv;

    rv = ldapu_propval_alloc("prop3", 0, &propval);
    if (rv != LDAPU_SUCCESS) return rv;

    rv = ldapu_list_add_info(propval_list, propval);
    if (rv != LDAPU_SUCCESS) return rv;

    rv = ldapu_certinfo_modify("newmap", "o=Mcom Communications, c=US",
			       propval_list);

    ldapu_propval_list_free(propval_list);

    if (rv != LDAPU_SUCCESS) {
	fprintf(stderr, "ldapu_certinfo_delete failed.  Reason: %s\n",
		ldapu_err2string(rv));
	return rv;
    }

    rv = ldapu_certinfo_save(fname, old_fname, "certmap.tmp");

    if (rv != LDAPU_SUCCESS) {
	fprintf(stderr, "ldapu_certinfo_new_test failed.  Reason: %s\n",
		ldapu_err2string(rv));
    }

    return rv;
}

static int get_dbnames_test (const char *mapfile)
{
    char **names;
    int cnt;
    int rv;
    int i;

    rv = dbconf_get_dbnames(mapfile, &names, &cnt);

    if (rv != LDAPU_SUCCESS) {
	fprintf(stderr, "get_dbnames_test failed. Reason: %s\n",
		ldapu_err2string(rv));
    }
    else {
	for(i = 0; i < cnt; i++) {
	    fprintf(stderr, "\tdbname[%d] = \"%s\"\n", 
		    i, names[i]);
	}
    }

    dbconf_free_dbnames(names);

    return rv;
}

static int case_ignore_strcmp (const char *s1, const char *s2)
{
    int ls1, ls2;		/* tolower values of chars in s1 & s2 resp. */

    if (!s1) return !s2 ? 0 : 0-tolower(*s2);
    else if (!s2) return tolower(*s1);

    while(*s1 && *s2 && (ls1 = tolower(*s1)) == (ls2 = tolower(*s2))) { s1++; s2++; }

    if (!*s1)
	return *s2 ? 0-tolower(*s2) : 0;
    else if (!*s2)
	return tolower(*s1);
    else
	return ls1 - ls2;
}

#define STRCASECMP3(s1, s2, rv) \
{ \
    int i = case_ignore_strcmp(s1, s2); \
    fprintf(stderr, "strcasecmp(\"%s\", \"%s\")\t=\t%d\t%s\tExpected: %d\n", \
	    s1 ? s1 : "<NULL>", s2 ? s2 : "<NULL>", \
	    i, i == rv ? "SUCCESS" : "FAILED", rv); \
}

#ifndef XP_WIN32
#define STRCASECMP(s1, s2) STRCASECMP3(s1, s2, strcasecmp(s1, s2))
#else
#define STRCASECMP(s1, s2) STRCASECMP3(s1, s2, case_ignore_strcmp(s1, s2))
#endif

static void strcasecmp_test ()
{
    STRCASECMP3(0, "aBcD", 0-tolower('a'));
    STRCASECMP3(0, 0, 0);
    STRCASECMP3("aBcD", 0, tolower('a'));

    STRCASECMP("AbCd", "aBcD");
    STRCASECMP("AbCd", "abcd");
    STRCASECMP("ABCD", "ABCD");
    STRCASECMP("abcd", "abcd");

    STRCASECMP("AbCd", "aBcD3");
    STRCASECMP("AbCd", "abcd3");
    STRCASECMP("ABCD", "ABCD3");
    STRCASECMP("abcd", "abcd3");
			      
    STRCASECMP("AbCd1", "aBcD");
    STRCASECMP("AbCd2", "abcd");
    STRCASECMP("ABCDX", "ABCD");
    STRCASECMP("abcdY", "abcd");

    STRCASECMP("AbCd5", "aBcD1");
    STRCASECMP("AbCd5", "abcd1");
    STRCASECMP("ABCD5", "ABCD1");
    STRCASECMP("abcd5", "abcd1");
			       
    STRCASECMP("AbCd2", "aBcDp");
    STRCASECMP("AbCd2", "abcdQ");
    STRCASECMP("ABCD2", "ABCDr");
    STRCASECMP("abcd2", "abcdS");
}

static int certmap_tests (const char *config_file) { return 0; }

static int read_config_test (const char *config_file, const char *dbname,
			     const char *url,
			     const char *binddn, const char *bindpw)
{
    int rv;
    DBConfDBInfo_t *db_info;
    char *dn;
    char *pw;

    rv = dbconf_read_default_dbinfo(config_file, &db_info);

    if (rv != LDAPU_SUCCESS) {
	fprintf(stderr, "config_test failed: %s\n",
		ldapu_err2string(rv));
	return LDAPU_FAILED;
    }

    if (strcmp(db_info->dbname, dbname) ||
	strcmp(db_info->url, url)) {
	fprintf(stderr, "config_test failed: %s\n",
		"first line in config file is wrong");
	return LDAPU_FAILED;
    }

    if ((ldapu_dbinfo_attrval(db_info, "binddn", &dn) != LDAPU_SUCCESS) ||
	(ldapu_dbinfo_attrval(db_info, "bindpw", &pw) != LDAPU_SUCCESS))
    {
	fprintf(stderr, "config_test failed: %s\n",
		"properties are missing");
	return LDAPU_FAILED;
    }

    if (strcmp(dn, binddn) ||
	strcmp(pw, bindpw)) {
	fprintf(stderr, "config_test failed: %s\n",
		"property values are wrong");
	return LDAPU_FAILED;
    }

    fprintf(stderr, "binddn from config file: \"%s\"\n", dn);
    fprintf(stderr, "bindpw from config file: \"%s\"\n", pw);

    /* cleanup */
    dbconf_free_dbinfo(db_info);
    free(dn);
    free(pw);

    return LDAPU_SUCCESS;
}

static int config_test (const char *binddn, const char *bindpw)
{
    char *config_file = "config_out.conf";
    FILE *fp = fopen(config_file, "w");
    const char *dbname = "default";
    const char *url = "file:/foobar/path";
    int rv;

    if (!fp) return LDAPU_FAILED;

    dbconf_output_db_directive(fp, dbname, url);
    dbconf_output_propval(fp, dbname, "binddn", binddn, 0);
    dbconf_output_propval(fp, dbname, "bindpw", bindpw, 1);

    fclose(fp);

    fprintf(stderr, "Config file written: %s\n", config_file);

    rv = read_config_test(config_file, dbname, url, binddn, bindpw);

    return rv;
}

static int
compare_groupid(const void *arg, const char *group, const int len)
{
    auto const char* groupid = (const char*)arg;
    auto int err = LDAPU_FAILED;
    if (len == strlen (groupid) && !strncasecmp (groupid, group, len)) {
	err = LDAPU_SUCCESS;
    }
    return err;
}

static int
compare_group(LDAP* directory, LDAPMessage* entry, void* set)
{
    auto int err = LDAPU_FAILED;
    auto char** vals = ldap_get_values (directory, entry, "CN");
    if (vals) {
	auto char** val;
	for (val = vals; *val; ++val) {
	    if (!strcasecmp (*val, (char*)set)) {
		err = LDAPU_SUCCESS;
		break;
	    }
	}
	ldap_value_free (vals);
    }
    return err;
}

int perform_test (int argc, char *argv[])
{
    int test_type;
    int retval = LDAPU_SUCCESS;
    DBConfDBInfo_t *db_info;
    LDAPDatabase_t *ldb;
    LDAP *ld;
    char *dbmap_file = "dblist.conf";
    char *binddn = 0;
    char *bindpw = 0;
    char *basedn;
    int retry = 1;
    int rv;

    fprintf(stderr, "\nStart of test: ./auth %s \"%s\" \"%s\"\n",
	    argv[1], argv[2], argv[3]);

    rv = dbconf_read_default_dbinfo(dbmap_file, &db_info);

    if (rv != LDAPU_SUCCESS) {
	fprintf(stderr, "Error reading dbmap file \"%s\".  Reason: %s\n",
		dbmap_file, ldapu_err2string(rv));
	return rv;
    }

    ldapu_dbinfo_attrval (db_info, LDAPU_ATTR_BINDDN, &binddn);
    ldapu_dbinfo_attrval (db_info, LDAPU_ATTR_BINDPW, &bindpw);

    rv = ldapu_url_parse (db_info->url, binddn, bindpw, &ldb);
    free(binddn);
    free(bindpw);

    if (rv != LDAPU_SUCCESS) {
	fprintf(stderr, "Error parsing ldap url \"%s\".  Reason: %s\n",
		db_info->url, ldapu_err2string(rv));
	return rv;
    }

    basedn = ldb->basedn;

    test_type = atoi(argv[1]);

    retry = 1;

    while(retry) {
	retry = 0;

	rv = ldapu_ldap_init_and_bind (ldb);

	if (rv != LDAPU_SUCCESS) {
	    fprintf(stderr, "Error initializing connection to LDAP.  Reason: %s\n",
		    ldapu_err2string(rv));
	    return rv;
	}

	ld = ldb->ld;

	switch(test_type) {
	case 1:
	    fprintf(stderr, "\nuserdn:\t\t\"%s\"\ngroupdn:\t\"%s\"\n",
		    argv[2], argv[3]);
	    retval = ldapu_auth_userdn_groupdn(ld, argv[2], argv[3], basedn);
	    break;

	case 2:
	    fprintf(stderr, "\nuid:\t\t\"%s\"\ngroupdn:\t\"%s\"\n", argv[2], argv[3]);
	    retval = ldapu_auth_uid_groupdn(ld, argv[2], argv[3], basedn);
	    break;

	case 3:
	    fprintf(stderr, "\nuid:\t\t\"%s\"\ngroupid:\t\"%s\"\n", argv[2], argv[3]);
	    retval = ldapu_auth_uid_groupid(ld, argv[2], argv[3], basedn);
	    break;

	case 4:
	    fprintf(stderr, "\nuserdn:\t\t\"%s\"\ngroupid:\t\"%s\"\n", argv[2], argv[3]);
	    retval = ldapu_auth_userdn_groupid(ld, argv[2], argv[3], basedn);
	    break;

	case 5:
	    fprintf(stderr, "\nuserdn:\t\t\"%s\"\nattrFilter:\t\"%s\"\n", argv[2], argv[3]);
	    retval = ldapu_auth_userdn_attrfilter(ld, argv[2], argv[3]);
	    break;

	case 6:
	    fprintf(stderr, "\nuid:\t\t\"%s\"\nattrFilter:\t\"%s\"\n", argv[2], argv[3]);
	    retval = ldapu_auth_uid_attrfilter(ld, argv[2], argv[3], basedn);
	    break;

	case 7:
	    fprintf(stderr, "\nuserdn:\t\t\"%s\"\npassword:\t\"%s\"\n", argv[2], argv[3]);
	    retval = ldapu_auth_userdn_password(ld, argv[2], argv[3]);
	    break;

	case 8:
	    fprintf(stderr, "\nuid:\t\t\"%s\"\npassword:\t\"%s\"\n", argv[2], argv[3]);
	    retval = ldapu_auth_uid_password(ld, argv[2], argv[3], basedn);
	    break;

	case 9: {
	    /* plugin test */
	    LDAPMessage *entry = 0;
	    LDAPMessage *res = 0;

	    fprintf(stderr, "Cert Map issuer DN: \"%s\"\n", argv[2]);
	    fprintf(stderr, "Cert Map subject DN: \"%s\"\n", argv[3]);
	    retval = ldaputil_init("certmap.conf", dllname, NULL, NULL, NULL);

	    if (retval != LDAPU_SUCCESS) {
		fprintf(stderr, "Cert Map info test failed.  Reason: %s\n",
			ldapu_err2string(retval));
		break;
	    }

	    if (*(argv[2]))
		global_issuer_dn = argv[2];
	    else
		global_issuer_dn = 0;

	    retval = ldapu_cert_to_ldap_entry(argv[3], ld, ldb->basedn, &res);

	    if (retval == LDAPU_SUCCESS) {
		char *dn;

		entry = ldap_first_entry(ld, res);
		dn = ldap_get_dn(ld, entry);
		fprintf(stderr, "Matched entry to cert: \"%s\"\n", dn);
		ldap_memfree(dn);
	    }
	    else if (retval == LDAPU_FAILED) {
		/* Not an error but couldn't map the cert */
	    }
	    else {
		fprintf(stderr, "Cert Map info test failed.  Reason: %s\n",
			ldapu_err2string(retval));
		break;
	    }

	    /* TEMPORARY -- when & how to free the entry */
	    if (res) ldap_msgfree(res);

	    break;
	} /* case 9 */

	case 10:
	    if ((retval = config_test(argv[2], argv[3])) == LDAPU_SUCCESS) {
		fprintf(stderr, "Config file test succeeded\n");
	    }
	    else {
		fprintf(stderr, "Config file test failed\n");
	    }
	    break;

	case 11:
	    retval = get_dbnames_test(argv[2]);
	    break;

	case 12:
	    retval = ldapu_certinfo_save_test(argv[2], argv[3]);
	    break;

	case 13:
	    retval = ldapu_certinfo_delete_test(argv[2], argv[3]);
	    break;

	case 14:
	    retval = ldapu_certinfo_new_test(argv[2], argv[3]);
	    break;

	case 15:
	    fprintf(stderr, "\nuserdn:\t\t\"%s\"\ngroupid:\t\"%s\"\n", argv[2], argv[3]);
	    {
		auto LDAPU_DNList_t* userDNs = ldapu_DNList_alloc();
		ldapu_DNList_add(userDNs, argv[2]);
		retval = ldapu_auth_usercert_groups(ld, basedn, userDNs, NULL,
						    argv[3], compare_group, 30, NULL);
		ldapu_DNList_free(userDNs);
	    }
	    break;

	case 16:
	    fprintf(stderr, "\nuserCert:\t\"%s\"\ngroupid:\t\"%s\"\n", argv[2], argv[3]);
	    retval = ldapu_auth_usercert_groupids(ld, NULL/*userDN*/, argv[2], argv[3],
						  compare_groupid, basedn, NULL/*group_out*/);
	    break;

	} /* switch */

	if (retval == LDAP_SERVER_DOWN) {
	    /* retry */
	    retry = 1;
	    ldb->ld = 0;
	}
	else if (retval == LDAPU_SUCCESS) {
	    fprintf(stderr, "Authentication succeeded.\n");
	}
	else {
	    fprintf(stderr, "Authentication failed.\n");
	}
    }

    /* cleanup */
//     ldapu_free_LDAPDatabase_t(ldb);
//     dbconf_free_dbinfo(db_info);
//     ldaputil_exit();
    return retval;
}

int main (int argc, char *argv[])
{
    int rv;

    NSPR_INIT("auth");

    if (argc != 4) {
        fprintf(stderr, "argc = %d\n", argc);
	fprintf(stderr, "usage: %s test_type user_dn group_dn\n", argv[0]);
	fprintf(stderr, "\t%s 1 <userdn> <groupdn>\n", argv[0]);
	fprintf(stderr, "\t%s 2 <uid> <groupdn>\n", argv[0]);
	fprintf(stderr, "\t%s 3 <uid> <groupid>\n", argv[0]);
	fprintf(stderr, "\t%s 4 <userdn> <groupid>\n", argv[0]);
	fprintf(stderr, "\t%s 5 <userdn> <attrFilter>\n", argv[0]);
	fprintf(stderr, "\t%s 6 <uid> <attrFilter>\n", argv[0]);
	fprintf(stderr, "\t%s 7 <userdn> <password>\n", argv[0]);
	fprintf(stderr, "\t%s 8 <uid> <password>\n", argv[0]);
	fprintf(stderr, "\t%s 9 <certmap.conf> <subjectDN>\n", argv[0]);
	fprintf(stderr, "\t%s 10 <binddn> <bindpw>\n", argv[0]);
	fprintf(stderr, "\t%s 11 <dbmap> <ignore>\n", argv[0]);
	fprintf(stderr, "\t%s 12 <newconfig> <oldconfig> ... to test save\n", argv[0]);
	fprintf(stderr, "\t%s 13 <newconfig> <oldconfig> ... to test delete\n", argv[0]);
	fprintf(stderr, "\t%s 14 <newconfig> <oldconfig> ... to test add\n", argv[0]);
	fprintf(stderr, "\t%s 15 <userdn> <groupid>\n", argv[0]);
	fprintf(stderr, "\t%s 16 <userCertDescription> <groupid>\n", argv[0]);
	exit(LDAP_PARAM_ERROR);
    }

    rv = perform_test(argc, argv);
    /*    PR_Exit(); */

    return rv;
}