File: plugprog.html

package info (click to toggle)
cyrus-sasl2 2.1.27%2Bdfsg-2.1%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 19,940 kB
  • sloc: ansic: 58,942; javascript: 8,745; sh: 4,843; java: 1,614; xml: 1,498; makefile: 1,265; python: 342; perl: 199
file content (892 lines) | stat: -rw-r--r-- 61,641 bytes parent folder | download | duplicates (2)
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
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892


<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Plugin Programmer’s Guide &mdash; Cyrus SASL 2.1.27 documentation</title>
  

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
  

  
    <link rel="stylesheet" href="../../_static/cyrus.css" type="text/css" />
  

  
        <link rel="index" title="Index"
              href="../../genindex.html"/>
        <link rel="search" title="Search" href="../../search.html"/>
    <link rel="top" title="Cyrus SASL 2.1.27 documentation" href="../../index.html"/>
        <link rel="up" title="Developers" href="../../developer.html"/>
        <link rel="next" title="Testing" href="testing.html"/>
        <link rel="prev" title="Application Programmer’s Guide" href="programming.html"/> 

  
  
  

</head>

<body class="wy-body-for-nav" role="document">

  
  
<div class="pageheader">
  <ul>
    <li><a href="../../index.html">Home</a></li>
    <li><a href="http://www.cyrusimap.org">Cyrus IMAP</a></li>
    <li><a href="../../download.html">Download</a></li>
    <li><a href="../../contribute.html">Contribute</a></li>
  </ul>
  <div>
    <a href="../../index.html">
      <img src="../../_static/logo.gif" alt="CYRUS SASL" />
    </a>
  </div>
</div>
<div style="clear: both;"></div>


  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-nav-search">
        

        
 
          <a href="../../index.html">
 

  
          
          <img src="../../_static/logo.gif"  />
     
        </a>

        
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

        
      </div>

      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
        
          
          
              <p class="caption"><span class="caption-text">Cyrus SASL</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../download.html">Download</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../../getsasl.html">Get SASL</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../installation.html">Installation</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../installation.html#quick-install-guide">Quick install guide</a></li>
<li class="toctree-l4"><a class="reference internal" href="../installation.html#detailed-installation-guide">Detailed installation guide</a></li>
<li class="toctree-l4"><a class="reference internal" href="../installation.html#supported-platforms">Supported platforms</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../release-notes/index.html">Release Notes</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../release-notes/index.html#supported-product-series">Supported Product Series</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../release-notes/index.html#series-2-1">Series 2.1</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../release-notes/index.html#older-versions">Older Versions</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../release-notes/index.html#series-2-2-0">Series 2: 2.0</a></li>
<li class="toctree-l4"><a class="reference internal" href="../release-notes/index.html#series-1">Series 1</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../packager.html">Note for Packagers</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../quickstart.html">Quickstart guide</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../quickstart.html#features">Features</a></li>
<li class="toctree-l2"><a class="reference internal" href="../quickstart.html#typical-installation">Typical Installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="../quickstart.html#configuration">Configuration</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../concepts.html">Concepts</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../concepts.html#sasl">SASL</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts.html#sasl-authentication-mechanisms">SASL Authentication Mechanisms</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts.html#security-layers">Security Layers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts.html#channel-binding">Channel Binding</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts.html#realms">Realms</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts.html#protocols">Protocols</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts.html#cyrus-sasl">Cyrus SASL</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts.html#the-glue-library">The Glue Library</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts.html#auxiliary-properties">Auxiliary Properties</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts.html#plugins">Plugins</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../setup.html">Setup</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../installation.html">Installation</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../installation.html#quick-install-guide">Quick install guide</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../installation.html#tarball-installation">Tarball installation</a></li>
<li class="toctree-l4"><a class="reference internal" href="../installation.html#unix-package-installation">Unix package Installation</a></li>
<li class="toctree-l4"><a class="reference internal" href="../installation.html#configuration">Configuration</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../installation.html#detailed-installation-guide">Detailed installation guide</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../installation.html#requirements">Requirements</a></li>
<li class="toctree-l4"><a class="reference internal" href="../installation.html#build-configuration">Build Configuration</a></li>
<li class="toctree-l4"><a class="reference internal" href="../installation.html#building-and-installation">Building and Installation</a></li>
<li class="toctree-l4"><a class="reference internal" href="../installation.html#compilation-hints">Compilation Hints</a></li>
<li class="toctree-l4"><a class="reference internal" href="../installation.html#application-configuration">Application Configuration</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../installation.html#supported-platforms">Supported platforms</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../upgrading.html">Upgrading from v1 to v2</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../upgrading.html#backwards-compatibility">Backwards Compatibility</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upgrading.html#coexistence-with-saslv1">Coexistence with SASLv1</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upgrading.html#database-upgrades">Database Upgrades</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upgrading.html#errors-on-migration">Errors on migration</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../components.html">Components</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../components.html#the-application">The Application</a></li>
<li class="toctree-l3"><a class="reference internal" href="../components.html#the-sasl-glue-layer">The SASL Glue Layer</a></li>
<li class="toctree-l3"><a class="reference internal" href="../components.html#plugins">Plugins</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../components.html#plugins-general">Plugins: General</a></li>
<li class="toctree-l4"><a class="reference internal" href="../components.html#plugins-sasl-mechanisms">Plugins: SASL Mechanisms</a></li>
<li class="toctree-l4"><a class="reference internal" href="../components.html#plugins-auxiliary-property">Plugins: Auxiliary Property</a></li>
<li class="toctree-l4"><a class="reference internal" href="../components.html#plugins-username-canonicalization">Plugins: Username Canonicalization</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../components.html#password-verification-services">Password Verification Services</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../options.html">Options</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../options.html#sasl-library">SASL Library</a></li>
<li class="toctree-l3"><a class="reference internal" href="../options.html#auxiliary-property-plugin">Auxiliary Property Plugin</a></li>
<li class="toctree-l3"><a class="reference internal" href="../options.html#gssapi">GSSAPI</a></li>
<li class="toctree-l3"><a class="reference internal" href="../options.html#ldapdb">LDAPDB</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../options.html#notes-on-ldapdb">Notes on LDAPDB</a></li>
<li class="toctree-l4"><a class="reference internal" href="../options.html#examples">Examples</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../options.html#ntlm">NTLM</a></li>
<li class="toctree-l3"><a class="reference internal" href="../options.html#otp">OTP</a></li>
<li class="toctree-l3"><a class="reference internal" href="../options.html#digest-md5">Digest-md5</a></li>
<li class="toctree-l3"><a class="reference internal" href="../options.html#sasldb">SASLDB</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../options.html#notes-on-sasldb-with-lmdb">Notes on sasldb with LMDB</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../options.html#sql-plugin">SQL Plugin</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../options.html#notes-on-sql">Notes on SQL</a></li>
<li class="toctree-l4"><a class="reference internal" href="../options.html#id2">Examples</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../options.html#srp">SRP</a></li>
<li class="toctree-l3"><a class="reference internal" href="../options.html#kerberos-v4">Kerberos V4</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../advanced.html">Advanced Usage</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../advanced.html#notes-for-advanced-usage-of-libsasl">Notes for Advanced Usage of libsasl</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../advanced.html#using-cyrus-sasl-as-a-static-library">Using Cyrus SASL as a static library</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../operations.html">Operations</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../sysadmin.html">System Administrators</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../sysadmin.html#what-sasl-is">What SASL is</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../sysadmin.html#authentication-and-authorization-identifiers">Authentication and authorization identifiers</a></li>
<li class="toctree-l4"><a class="reference internal" href="../sysadmin.html#realms">Realms</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../sysadmin.html#how-sasl-works">How SASL works</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../sysadmin.html#the-plain-mechanism-sasl-checkpass-and-plaintext-passwords">The PLAIN mechanism, <code class="docutils literal"><span class="pre">sasl_checkpass()</span></code>, and plaintext passwords</a></li>
<li class="toctree-l4"><a class="reference internal" href="../sysadmin.html#shared-secrets-mechanisms">Shared secrets mechanisms</a></li>
<li class="toctree-l4"><a class="reference internal" href="../sysadmin.html#kerberos-mechanisms">Kerberos mechanisms</a></li>
<li class="toctree-l4"><a class="reference internal" href="../sysadmin.html#the-otp-mechanism">The OTP mechanism</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../sysadmin.html#auxiliary-properties">Auxiliary Properties</a></li>
<li class="toctree-l3"><a class="reference internal" href="../sysadmin.html#how-to-set-configuration-options">How to set configuration options</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../sysadmin.html#the-default-configuration-file">The default configuration file</a></li>
<li class="toctree-l4"><a class="reference internal" href="../sysadmin.html#application-configuration">Application configuration</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../sysadmin.html#troubleshooting">Troubleshooting</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../manpages.html">Man pages</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../manpages.html#library-files">(3) Library Files</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl.html"><strong>SASL</strong> - SASL Authentication Library</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_authorize_t.html"><strong>sasl_authorize_t</strong> - The SASL authorization callback</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_auxprop.html"><strong>sasl_auxprop</strong> - How to work with SASL auxiliary properties</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_auxprop_add_plugin.html"><strong>sasl_auxprop_add_plugin</strong> - add a SASL auxiliary property plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_auxprop_getctx.html"><strong>sasl_auxprop_getctx</strong> - Acquire an auxiliary property context</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_auxprop_request.html"><strong>sasl_auxprop_request</strong> - Request auxiliary properties from SASL</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_callbacks.html"><strong>sasl_callbacks</strong> - How to work with SASL callbacks</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_canon_user_t.html"><strong>sasl_canon_user_t</strong> - Application-supplied user canonicalization function</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_canonuser_add_plugin.html"><strong>sasl_canonuser_add_plugin</strong> - add a SASL user canonicalization plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_chalprompt_t.html"><strong>sasl_chalprompt_t</strong> - Realm acquisition callback</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_checkapop.html"><strong>sasl_checkapop</strong> - Check an APOP challenge/response</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_checkpass.html"><strong>sasl_checkpass</strong> - Check a plaintext password</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_client_add_plugin.html"><strong>sasl_client_add_plugin</strong> - add a SASL client plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_client_done.html"><strong>sasl_client_done</strong> - Cleanup function</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_client_init.html"><strong>sasl_client_init</strong> - SASL client authentication initialization</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_client_new.html"><strong>sasl_client_new</strong> - Create a new client authentication object</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_client_plug_init_t.html"><strong>sasl_client_plug_init_t</strong> - client plug‐in entry point</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_client_start.html"><strong>sasl_client_start</strong> - Begin an authentication negotiation</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_client_step.html"><strong>sasl_client_step</strong> - Perform a step in the authentication negotiation</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_decode.html"><strong>sasl_decode</strong> - Decode data received</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_decode64.html"><strong>sasl_decode64</strong> - Decode base64 string</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_dispose.html"><strong>sasl_dispose</strong> - Dispose of a SASL connection object</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_done.html"><strong>sasl_done</strong> - Dispose of a SASL connection object</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_encode.html"><strong>sasl_encode</strong> - Encode data for transport to authenticated host</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_encode64.html"><strong>sasl_encode64</strong> - Encode base64 string</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_encodev.html"><strong>sasl_encodev</strong> - Encode data for transport to authenticated host</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_erasebuffer.html"><strong>sasl_erasebuffer</strong> - erase buffer</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_errdetail.html"><strong>sasl_errdetail</strong> - Retrieve  detailed information about an error</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_errors.html"><strong>sasl_errors</strong> - SASL error codes</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_errstring.html"><strong>sasl_errstring</strong> - Translate a SASL return code to a human-readable form</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_getcallback_t.html"><strong>sasl_getcallback_t</strong> - callback function to lookup a sasl_callback_t for a connection</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_getconfpath_t.html"><strong>sasl_getconfpath_t</strong> - The SASL callback to indicate location of the config files</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_getopt_t.html"><strong>sasl_getopt_t</strong> - The SASL get option callback</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_getpath_t.html"><strong>sasl_getpath_t</strong> - The SASL callback to indicate location of the mechanism drivers</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_getprop.html"><strong>sasl_getprop</strong> - Get a SASL property</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_getrealm_t.html"><strong>sasl_getrealm_t</strong> - Realm Acquisition Callback</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_getsecret_t.html"><strong>sasl_getsecret_t</strong> - The SASL callback for secrets (passwords)</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_getsimple_t.html"><strong>sasl_getsimple_t</strong> - The SASL callback for username/authname/realm</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_global_listmech.html"><strong>sasl_global_listmech</strong> - Retrieve a list of the supported SASL mechanisms</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_idle.html"><strong>sasl_idle</strong> - Perform precalculations during an idle period</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_listmech.html"><strong>sasl_listmech</strong> - Retrieve a list of the supported SASL mechanisms</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_log_t.html"><strong>sasl_log_t</strong> - The SASL logging callback</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_server_add_plugin.html"><strong>sasl_server_add_plugin</strong> - add a SASL server plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_server_done.html"><strong>sasl_server_done</strong> - Cleanup function</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_server_init.html"><strong>sasl_server_init</strong> - SASL server authentication initialization</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_server_new.html"><strong>sasl_server_new</strong> - Create a new server authentication object</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_server_plug_init_t.html"><strong>sasl_server_plug_init_t</strong> - server plug‐in entry point</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_server_start.html"><strong>sasl_server_start</strong> - Begin an authentication negotiation</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_server_step.html"><strong>sasl_server_step</strong> - Perform a step in the authentication negotiation</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_server_userdb_checkpass_t.html"><strong>sasl_server_userdb_checkpass_t</strong> - Plaintext Password Verification Callback</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_server_userdb_setpass_t.html"><strong>sasl_server_userdb_setpass_t</strong> - UserDB Plaintext Password Setting Callback</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_set_alloc.html"><strong>sasl_set_alloc</strong> - set the memory allocation functions used by the SASL library</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_set_mutex.html"><strong>sasl_set_mutex</strong> - set the mutex lock functions used by the SASL library</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_seterror.html"><strong>sasl_seterror</strong> - set the error string</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_setpass.html"><strong>sasl_setpass</strong> - Check a plaintext password</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_setprop.html"><strong>sasl_setprop</strong> - Set a SASL property</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_user_exists.html"><strong>sasl_user_exists</strong> - Check if a user exists on server</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_usererr.html"><strong>sasl_usererr</strong> - Remove information leak about accounts from sasl error codes</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_utf8verify.html"><strong>sasl_utf8verify</strong> - Verify a string is valid utf8</a></li>
<li class="toctree-l4"><a class="reference internal" href="../reference/manpages/library/sasl_verifyfile_t.html"><strong>sasl_verifyfile_t</strong> - The SASL file verification</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../auxiliary_properties.html">Auxiliary Properties</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../auxiliary_properties.html#auxiliary-properties-and-the-glue-layer">Auxiliary Properties and the Glue Layer</a></li>
<li class="toctree-l3"><a class="reference internal" href="../auxiliary_properties.html#passwords-and-other-data">Passwords and other Data</a></li>
<li class="toctree-l3"><a class="reference internal" href="../auxiliary_properties.html#sasldb">sasldb</a></li>
<li class="toctree-l3"><a class="reference internal" href="../auxiliary_properties.html#ldapdb">ldapdb</a></li>
<li class="toctree-l3"><a class="reference internal" href="../auxiliary_properties.html#sql">sql</a></li>
<li class="toctree-l3"><a class="reference internal" href="../auxiliary_properties.html#user-canonicalization">User Canonicalization</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../authentication_mechanisms.html">Authentication Mechanisms</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../authentication_mechanisms.html#mechanisms">Mechanisms</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#anonymous">ANONYMOUS</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#cram-md5">CRAM-MD5</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#digest-md5">DIGEST-MD5</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#external">EXTERNAL</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#g2">G2</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#gssapi">GSSAPI</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#gss-spegno">GSS-SPEGNO</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#kerberos-v4">KERBEROS_V4</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#login">LOGIN</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#ntlm">NTLM</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#otp">OTP</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#passdss">PASSDSS</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#plain">PLAIN</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#scram">SCRAM</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#srp">SRP</a></li>
<li class="toctree-l4"><a class="reference internal" href="../authentication_mechanisms.html#non-sasl-authentication">Non-SASL Authentication</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../authentication_mechanisms.html#summary">Summary</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../pwcheck.html">Pwcheck</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../pwcheck.html#auxprop">Auxprop</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pwcheck.html#auxprop-hashed">Auxprop-hashed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pwcheck.html#saslauthd">Saslauthd</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pwcheck.html#authdaemon">Authdaemon</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pwcheck.html#alwaystrue">Alwaystrue</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pwcheck.html#auto-transition">Auto Transition</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../faq.html">Frequently Asked Questions</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../faqs/authorize-vs-authenticate.html">What is the difference between an Authorization ID and a Authentication ID?</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faqs/crammd5-digestmd5.html">Why do CRAM-MD5 and DIGEST-MD5 not work with CyrusSaslauthd?</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faqs/openldap-sasl-gssapi.html">How do I configure OpenLDAP +SASL+GSSAPI?</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faqs/plaintextpasswords.html">Why does CyrusSasl store plaintext passwords in its databases?</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faqs/rfcs.html">RFCs and drafts</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faqs/upgrade-saslv2.html">Why am I having a problem running dbconverter-2 to upgrade from SASLv1 to SASLv2?</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../resources.html">Other Documentation &amp; Resources</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="reference internal" href="../../developer.html">Developers</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../appconvert.html">Converting Applications from v1 to v2</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../appconvert.html#tips-for-both-clients-and-servers">Tips for both clients and servers</a></li>
<li class="toctree-l3"><a class="reference internal" href="../appconvert.html#tips-for-clients">Tips for clients</a></li>
<li class="toctree-l3"><a class="reference internal" href="../appconvert.html#tips-for-servers">Tips for Servers</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="programming.html">Application Programmer’s Guide</a><ul>
<li class="toctree-l3"><a class="reference internal" href="programming.html#introduction">Introduction</a><ul>
<li class="toctree-l4"><a class="reference internal" href="programming.html#about-this-guide">About this Guide</a></li>
<li class="toctree-l4"><a class="reference internal" href="programming.html#what-is-sasl">What is SASL?</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="programming.html#background">Background</a><ul>
<li class="toctree-l4"><a class="reference internal" href="programming.html#how-did-the-world-work-before-sasl">How did the world work before SASL?</a></li>
<li class="toctree-l4"><a class="reference internal" href="programming.html#sasl-to-the-rescue">SASL to the rescue!</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="programming.html#briefly">Briefly</a><ul>
<li class="toctree-l4"><a class="reference internal" href="programming.html#what-is-the-cyrus-sasl-library-good-for">What is the Cyrus SASL library good for?</a></li>
<li class="toctree-l4"><a class="reference internal" href="programming.html#what-does-the-cyrus-sasl-library-do">What does the Cyrus SASL library do?</a></li>
<li class="toctree-l4"><a class="reference internal" href="programming.html#what-doesn-t-the-cyrus-sasl-library-do">What doesn’t the Cyrus SASL library do?</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="programming.html#client-only-section">Client-only Section</a><ul>
<li class="toctree-l4"><a class="reference internal" href="programming.html#a-typical-interaction-from-the-client-s-perspective">A typical interaction from the client’s perspective</a></li>
<li class="toctree-l4"><a class="reference internal" href="programming.html#how-does-this-look-in-code">How does this look in code</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="programming.html#server-only-section">Server-only Section</a><ul>
<li class="toctree-l4"><a class="reference internal" href="programming.html#a-typical-interaction-from-the-server-s-perspective">A typical interaction from the server’s perspective</a></li>
<li class="toctree-l4"><a class="reference internal" href="programming.html#id1">How does this look in code?</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="programming.html#common-section">Common Section</a><ul>
<li class="toctree-l4"><a class="reference internal" href="programming.html#callbacks-and-interactions">Callbacks and Interactions</a></li>
<li class="toctree-l4"><a class="reference internal" href="programming.html#security-layers">Security layers</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="programming.html#example-applications-that-come-with-the-cyrus-sasl-library">Example applications that come with the Cyrus SASL library</a><ul>
<li class="toctree-l4"><a class="reference internal" href="programming.html#sample-client-and-sample-server"><cite>sample-client</cite> and <cite>sample-server</cite></a></li>
<li class="toctree-l4"><a class="reference internal" href="programming.html#cyrus-imapd-v2-1-0-or-later">Cyrus imapd v2.1.0 or later</a></li>
<li class="toctree-l4"><a class="reference internal" href="programming.html#imtest-from-cyrus-2-1-0-or-later"><cite>imtest</cite>, from Cyrus 2.1.0 or later</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="programming.html#miscellaneous-information">Miscellaneous Information</a><ul>
<li class="toctree-l4"><a class="reference internal" href="programming.html#empty-exchanges">Empty exchanges</a></li>
<li class="toctree-l4"><a class="reference internal" href="programming.html#idle">Idle</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Plugin Programmer’s Guide</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#introduction">Introduction</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#about-this-guide">About this Guide</a></li>
<li class="toctree-l4"><a class="reference internal" href="#what-is-sasl">What is SASL?</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#common-section">Common Section</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#overview-of-plugin-programming">Overview of Plugin Programming</a></li>
<li class="toctree-l4"><a class="reference internal" href="#use-of-sasl-utils-t">Use of sasl_utils_t</a></li>
<li class="toctree-l4"><a class="reference internal" href="#error-reporting">Error Reporting</a></li>
<li class="toctree-l4"><a class="reference internal" href="#memory-allocation">Memory Allocation</a></li>
<li class="toctree-l4"><a class="reference internal" href="#client-send-first-server-send-last">Client Send First / Server Send Last</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#client-plugins">Client Plugins</a></li>
<li class="toctree-l3"><a class="reference internal" href="#server-plugins">Server Plugins</a></li>
<li class="toctree-l3"><a class="reference internal" href="#user-canonicalization-canon-user-plugins">User Canonicalization (canon_user) Plugins</a></li>
<li class="toctree-l3"><a class="reference internal" href="#auxiliary-property-auxprop-plugins">Auxiliary Property (auxprop) Plugins</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="testing.html">Testing</a><ul>
<li class="toctree-l3"><a class="reference internal" href="testing.html#testing-the-cmu-sasl-library-with-the-included-sample-applications">Testing the CMU SASL Library with the included sample applications</a><ul>
<li class="toctree-l4"><a class="reference internal" href="testing.html#example">Example</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="testing.html#running-the-testsuite-application">Running the Testsuite application</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../support.html">Support/Community</a></li>
</ul>
<p class="caption"><span class="caption-text">IMAP</span></p>
<ul>
<li class="toctree-l1"><a class="reference external" href="http://www.cyrusimap.org">Cyrus IMAP</a></li>
</ul>

          
        
      </div>
      &nbsp;
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href="../../index.html">Cyrus SASL</a>
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          
          <div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../index.html">Docs v2.1.27</a> &raquo;</li>
      
          <li><a href="../../developer.html">Developers</a> &raquo;</li>
      
    <li>Plugin Programmer’s Guide</li>
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="https://github.com/cyrusimap/cyrus-sasl/blob/master/docsrc/sasl/developer/plugprog.rst" class="fa fa-github"> Edit on GitHub</a>
          
        
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document">
            
  <div class="section" id="plugin-programmer-s-guide">
<span id="plugprog"></span><h1>Plugin Programmer’s Guide<a class="headerlink" href="#plugin-programmer-s-guide" title="Permalink to this headline">¶</a></h1>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">NOTE: This is a work in progress. Any contributions would be
<em>very</em> appreciated.</p>
</div>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#introduction" id="id1">Introduction</a><ul>
<li><a class="reference internal" href="#about-this-guide" id="id2">About this Guide</a></li>
<li><a class="reference internal" href="#what-is-sasl" id="id3">What is SASL?</a></li>
</ul>
</li>
<li><a class="reference internal" href="#common-section" id="id4">Common Section</a><ul>
<li><a class="reference internal" href="#overview-of-plugin-programming" id="id5">Overview of Plugin Programming</a></li>
<li><a class="reference internal" href="#use-of-sasl-utils-t" id="id6">Use of sasl_utils_t</a></li>
<li><a class="reference internal" href="#error-reporting" id="id7">Error Reporting</a></li>
<li><a class="reference internal" href="#memory-allocation" id="id8">Memory Allocation</a></li>
<li><a class="reference internal" href="#client-send-first-server-send-last" id="id9">Client Send First / Server Send Last</a></li>
</ul>
</li>
<li><a class="reference internal" href="#client-plugins" id="id10">Client Plugins</a></li>
<li><a class="reference internal" href="#server-plugins" id="id11">Server Plugins</a></li>
<li><a class="reference internal" href="#user-canonicalization-canon-user-plugins" id="id12">User Canonicalization (canon_user) Plugins</a></li>
<li><a class="reference internal" href="#auxiliary-property-auxprop-plugins" id="id13">Auxiliary Property (auxprop) Plugins</a></li>
</ul>
</div>
<div class="section" id="introduction">
<h2><a class="toc-backref" href="#id1">Introduction</a><a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<div class="section" id="about-this-guide">
<h3><a class="toc-backref" href="#id2">About this Guide</a><a class="headerlink" href="#about-this-guide" title="Permalink to this headline">¶</a></h3>
<p>This guide gives a brief overview on the things that one
needs to know to write a <a class="reference internal" href="../authentication_mechanisms.html#authentication-mechanisms"><span class="std std-ref">mechanism</span></a> for the SASLv2 API (and thus
Cyrus SASLv2).  Note that this page is a brief overview
and that the authoritative documentation are the header files
included in the SASL distribution.  If you have any questions, please
feel free to contact the <a class="reference external" href="https://www.cyrusimap.org/contribute.html#contribute" title="(in Cyrus IMAP v3.0.8)"><span class="xref std std-ref">Cyrus development team</span></a>.</p>
<p>Please note that this guide is only intended for developers looking
to write mechanisms for the SASLv2 API, and that application programmers
should be reading the <a class="reference internal" href="programming.html#programming"><span class="std std-ref">Application Programming Guide</span></a> instead.</p>
</div>
<div class="section" id="what-is-sasl">
<h3><a class="toc-backref" href="#id3">What is SASL?</a><a class="headerlink" href="#what-is-sasl" title="Permalink to this headline">¶</a></h3>
<p>A description of SASL is covered in detail in the
<a class="reference internal" href="programming.html#programming"><span class="std std-ref">programmer’s guide</span></a>, which mechanism
developers should probably read first anyway to become familiar
with development using the SASL library.</p>
</div>
</div>
<div class="section" id="common-section">
<h2><a class="toc-backref" href="#id4">Common Section</a><a class="headerlink" href="#common-section" title="Permalink to this headline">¶</a></h2>
<div class="section" id="overview-of-plugin-programming">
<h3><a class="toc-backref" href="#id5">Overview of Plugin Programming</a><a class="headerlink" href="#overview-of-plugin-programming" title="Permalink to this headline">¶</a></h3>
<p>The basic idea behind programming plugins for Cyrus SASL rests in
the ability to dlopen a shared library.  Thus, all plugins should
be shared libraries.  It is recommended that they are libtool
libraries for portability reasons (Cyrus SASL parses .la files to
get the appropriate name to dlopen), but they can have an extention
of .so as well.</p>
<p>All plugins should live in the same directory
(generally /usr/lib/sasl2), which the glue code (that is, the interface
layer that sits between the plugins and the application) scans
when one of the init functions (sasl_server_init or sasl_client_init)
is called.  Cyrus SASL then attempts to open each library and
run an initialization function.  If the initialization function
succeeds, and the versions match, then the glue code determines
that the load was successful and the plugin is available for use.</p>
<p>There are serveral types of plugins (note that a given plugin library
may contain any or all of the following in combination, though
such a plugin would be a beast!):</p>
<dl class="docutils">
<dt>Mechanism Plugins</dt>
<dd>These plugins implement mechanisms
for authentication, and are the majority of the plugins included
with Cyrus SASL.  Generally implementing both a client and a server
side they take care of the authentication process.</dd>
<dt>User Canonicalization Plugins</dt>
<dd>These plugins enable differing
ways of canonicalizing authentication and authorization IDs.</dd>
<dt>Auxiliary Property Plugins</dt>
<dd>These plugins allow auxilliary
properties about user accounts to be looked up, such as passwords.
Cyrus SASL includes a plugin to read sasldb files, for example.</dd>
</dl>
</div>
<div class="section" id="use-of-sasl-utils-t">
<h3><a class="toc-backref" href="#id6">Use of sasl_utils_t</a><a class="headerlink" href="#use-of-sasl-utils-t" title="Permalink to this headline">¶</a></h3>
<p>Because of the way that shared library plugins are loaded for both
speed and namespace reasons, the symbol tables are not shared across
plugins.  Thus, the only interface that the plugin should assume it
has to the outside world is through the <code class="docutils literal"><span class="pre">sasl_utils_t</span></code> structure (or
through links that it specifically requires).  Likewise, the glue code
has no (and will use no) interface into the plugin other than the
contents of the structures that are passed back to it by the
initialization function.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Do not assume you have access to any
functions except through links that your library explicitly makes
or through what is provided via the <code class="docutils literal"><span class="pre">sasl_utils_t</span></code> structure.</p>
</div>
</div>
<div class="section" id="error-reporting">
<h3><a class="toc-backref" href="#id7">Error Reporting</a><a class="headerlink" href="#error-reporting" title="Permalink to this headline">¶</a></h3>
<p>Error reporting is very important for failed authentication tracking
and helping to debug installations or authentication problems.  For
that reason, in addition to the standard SASL return codes, the
glue code provides an interface to its seterror function (via
<code class="docutils literal"><span class="pre">sasl_utils_t</span></code>).  This function sets detailed error information for
a given connection.</p>
<p>In order to ensure consistency of this information, it is the
responsibility of the deepest function with access to the sasl_conn_t
make the call to set the errdetail string.</p>
</div>
<div class="section" id="memory-allocation">
<h3><a class="toc-backref" href="#id8">Memory Allocation</a><a class="headerlink" href="#memory-allocation" title="Permalink to this headline">¶</a></h3>
<p>Memory allocation in SASLv2 follows the simple paradigm that <strong>if you
allocate it, you free it</strong>.  This improves portability, and allows
for a large performance improvement over SASLv1.  To prevent memory
leaks (especially in the mechanism plugins), please ensure that you
follow this paradigm.</p>
</div>
<div class="section" id="client-send-first-server-send-last">
<h3><a class="toc-backref" href="#id9">Client Send First / Server Send Last</a><a class="headerlink" href="#client-send-first-server-send-last" title="Permalink to this headline">¶</a></h3>
<p>Mechanism plugins used to have to worry about the situation
where they needed clients to send first (or server to send last), yet
the protocol did not support it.  Luckily, this is now handled by
the glue code, provided that the plugin declares the appropriate flags
in the structure returned by its init function.  Thus, the step functions
will not have to worry about these issues and can be implemented
knowing they will be called only when the application actually has
data for them and/or will allow them to send data.  These flags are as
follows:</p>
<dl class="docutils">
<dt>SASL_FEAT_WANT_CLIENT_FIRST</dt>
<dd>The mechanism has the client
side send first always.  (e.g. PLAIN)</dd>
<dt>SASL_FEAT_SERVER_FIRST</dt>
<dd>The mechanism has the server side
send first always.  (e.g. CRAM-MD5)</dd>
</dl>
<p>If neither flag is set, the mechanism will handle the client-send
first situation internally, because the client may or may not send
first.  (e.g. DIGEST-MD5).  In this case, the plugin must
intelligently check for the presence (or absence) of clientin/serverin
data.  Note that the optional client send-first is only possible when the
protocol permits an initial response.</p>
<p>The server send last situation is handled by the plugin intelligently
setting *serverout when the step function returns SASL_OK.</p>
<ul class="simple">
<li>For mechanisms
which never send last (e.g. PLAIN), *serverout must be set to NULL.</li>
<li>For
mechanisms which always send last (e.g. DIGEST-MD5), *serverout must
point to the success data.</li>
<li>For mechanisms in which the server may or
may not send last (e.g. SRP), *serverout must be set accordingly.</li>
</ul>
</div>
</div>
<div class="section" id="client-plugins">
<span id="plugprog-client"></span><h2><a class="toc-backref" href="#id10">Client Plugins</a><a class="headerlink" href="#client-plugins" title="Permalink to this headline">¶</a></h2>
<p>Client-side mechanism plugins are generally included in the same
plugin with their <a class="reference internal" href="#plugprog-server"><span class="std std-ref">server</span></a> counterpart, though
this is not a requirement.  They take care of the client-side of the
SASL negotiation.  For a simple example, see the ANONYMOUS plugin.
Client plugins must export <code class="docutils literal"><span class="pre">sasl_client_plug_init</span></code> which returns
a <code class="docutils literal"><span class="pre">sasl_client_plug_t</span></code> in order to load.  The structure has
several functional members and a global context (which applies to
all connections using the plugin).  The important ones are described
briefly here.</p>
<dl class="docutils">
<dt>mech_new</dt>
<dd><p class="first">Called at the beginning of each connection,
(on a call to sasl_client_start),</p>
<p class="last">mech_new does mechanism-specific initialization, and if necessary
allocates a connection context (which the glue code keeps track
of for it).  mech_new does not actually send any data to the client,
it simply allocates the context.</p>
</dd>
<dt>mech_step</dt>
<dd><p class="first">Called from <code class="docutils literal"><span class="pre">sasl_client_start</span></code> and
<code class="docutils literal"><span class="pre">sasl_client_step</span></code>, this function does the actual work of
the client
side of the authentication.  If authentication is successful, it
should return SASL_OK, otherwise it should return a valid SASL
error code (and call seterror).</p>
<p>This should also set up the
oparams structure before returning SASL_OK, including any
security layer information (in the way of callbacks).</p>
<p class="last">Note
that as soon as the client has both the authentication and
authorization IDs, it MUST call the canon_user function provided
in its params structure (for both the authentication and
authorization IDs, with SASL_CU_AUTHID and SASL_CU_AUTHZID
respectively).</p>
</dd>
<dt>mech_dispose</dt>
<dd>Called to dispose of a connection context.
This is only called when the connection will no longer be used
(e.g. when <code class="docutils literal"><span class="pre">sasl_dispose</span></code> is called)</dd>
<dt>mech_free</dt>
<dd>Called when the sasl library is shutting down
(by <code class="docutils literal"><span class="pre">sasl_client_done/sasl_server_done/sasl_done</span></code>).
Intended to free any global state of the plugin.</dd>
</dl>
</div>
<div class="section" id="server-plugins">
<span id="plugprog-server"></span><h2><a class="toc-backref" href="#id11">Server Plugins</a><a class="headerlink" href="#server-plugins" title="Permalink to this headline">¶</a></h2>
<p>Server-side mechanism plugins are generally included in the same
plugin with their <a class="reference internal" href="#plugprog-client"><span class="std std-ref">client</span></a> counterpart, though
this is not a requirement.  They take care of the server-side of the
SASL negotiation, and are generally more complicated than their
client-side counterparts.  For a simple example, see the ANONYMOUS
plugin.</p>
<p>Server plugins must export <code class="docutils literal"><span class="pre">sasl_server_plug_init</span></code> which returns
a <code class="docutils literal"><span class="pre">sasl_server_plug_t</span></code> in order to load.  The structure has
several functional members and a global context (which applies to
all connections using the plugin).  The important ones are described
briefly here.</p>
<dl class="docutils">
<dt>mech_new</dt>
<dd><p class="first">Called at the beginning of each connection,
(on a call to sasl_client_start),</p>
<p class="last">mech_new does mechanism-specific initialization, and if necessary
allocates a connection context (which the glue code keeps track
of for it).  mech_new does not actually send any data to the client,
it simply allocates the context.</p>
</dd>
<dt>mech_step</dt>
<dd><p class="first">Called from <code class="docutils literal"><span class="pre">sasl_server_start</span></code> and
<code class="docutils literal"><span class="pre">sasl_server_step</span></code>, this function does the actual work of
the server
side of the authentication.</p>
<p>If authentication is successful, it
should return SASL_OK, otherwise it should return a valid SASL
error code (and call seterror).  This should also set up the
oparams structure before returning SASL_OK, including any
security layer information (in the way of callbacks and SSF
information).</p>
<p>Also, as soon
as the mechanism has computed both the authentication and the
authorization IDs, it MUST call the canon_user function provided
in the server params structure (for both the authentication and
authorization IDs, with SASL_CU_AUTHID and SASL_CU_AUTHZID
respectively).  This action will also fill in its
propctx, so any auxiliary property <em>requests</em>
(for example, to lookup
the password) should be done before the request to canonicalize
the authentication id.  Authorization ID lookups do not occur until
after the plugin returns success to the SASL library.</p>
<p class="last">Before returning SASL_OK, <code class="docutils literal"><span class="pre">mech_step</span></code> must fill in the
oparams fields for which it is responsible, that is, <code class="docutils literal"><span class="pre">doneflag</span></code>
(set to 1 to indicate a complete exchange), <code class="docutils literal"><span class="pre">maxoutbuf</span></code>, or
the maximum output size it can do at once for a security layer,
<code class="docutils literal"><span class="pre">mech_ssf</span></code> or the supplied SSF of the security layer,
and <code class="docutils literal"><span class="pre">encode</span></code>, <code class="docutils literal"><span class="pre">decode</span></code>, <code class="docutils literal"><span class="pre">encode_context</span></code>,
and <code class="docutils literal"><span class="pre">decode_context</span></code>,
which are what the glue code will call on calls to <code class="docutils literal"><span class="pre">sasl_encode</span></code>,
<code class="docutils literal"><span class="pre">sasl_encodev</span></code>, and <code class="docutils literal"><span class="pre">sasl_decode</span></code>.</p>
</dd>
<dt>mech_dispose</dt>
<dd>Called to dispose of a connection context.
This is only called when the connection will no longer be used
(e.g. when <code class="docutils literal"><span class="pre">sasl_dispose</span></code> is called)</dd>
<dt>mech_free</dt>
<dd>Called when the sasl library is shutting down
(by <code class="docutils literal"><span class="pre">sasl_client_done/sasl_server_done/sasl_done</span></code>).
Intended to free any global state of the plugin.</dd>
<dt>setpass</dt>
<dd>Called to set a user’s password.  This allows
mechanisms to support their own internal password or secret
database.</dd>
<dt>mech_avail</dt>
<dd>Called by the first call to
<code class="docutils literal"><span class="pre">sasl_listmech</span></code>,
it checks to see if the mechanism is available for the given
user, and MAY allocate a connection context (thus avoiding
a call to <code class="docutils literal"><span class="pre">mech_new</span></code>).  However it should not do this
without significant performance benefit as it forces the glue
code to keep track of extra contexts that may not be used.</dd>
</dl>
</div>
<div class="section" id="user-canonicalization-canon-user-plugins">
<h2><a class="toc-backref" href="#id12">User Canonicalization (canon_user) Plugins</a><a class="headerlink" href="#user-canonicalization-canon-user-plugins" title="Permalink to this headline">¶</a></h2>
<p>User Canonicalization plugins allow for nonstandard ways of
canonicalizing the username.  They are subject to the following
requirements:</p>
<ul class="simple">
<li>They must copy their output into the provided output buffers.</li>
<li>The output buffers may be the same as the input buffers.</li>
<li>They must function for the case which is only an authentication
ID (flags == SASL_CU_AUTHID) or only an authorization ID
(flags == SASL_CU_AUTHZID) or both
(flags == SASL_CU_AUTHID | SASL_CU_AUTHZID)</li>
</ul>
<p>User canonicalization plugins must export a <code class="docutils literal"><span class="pre">sasl_canonuser_init</span></code>
function which returns a <code class="docutils literal"><span class="pre">sasl_canonuser_plug_t</span></code> in order
to load successfully.  They must implement at least one of
the <code class="docutils literal"><span class="pre">canon_user_client</span></code> or <code class="docutils literal"><span class="pre">canon_user_server</span></code> members
of the <code class="docutils literal"><span class="pre">sasl_canonuser_plug_t</span></code>.  The INTERNAL canon_user plugin
that is inside of the glue code implements both in the same way.</p>
</div>
<div class="section" id="auxiliary-property-auxprop-plugins">
<h2><a class="toc-backref" href="#id13">Auxiliary Property (auxprop) Plugins</a><a class="headerlink" href="#auxiliary-property-auxprop-plugins" title="Permalink to this headline">¶</a></h2>
<p>Perhaps the most exciting addition in SASLv2, Auxprop plugins
allow for an easy way to perform password and secret lookups (as well
as other information needed for authentication and authorization)
from directory services, and in the same request allow the application
to receive properties that it needs to provide the service.</p>
<p>Auxprop plugins need to export the <code class="docutils literal"><span class="pre">sasl_auxprop_init</span></code> function
and pass back a <code class="docutils literal"><span class="pre">sasl_auxprop_plug_t</span></code> in order to load
successfully.  The sasldb plugin included with the Cyrus SASL
distribution would be a good place to start.</p>
<p>Interfacing with property contexts is extremely well documented in
<code class="docutils literal"><span class="pre">prop.h</span></code> and so that is omitted here.  The only important
note is to be sure that you are using the interfaces provided
through the <code class="docutils literal"><span class="pre">sasl_utils_t</span></code> structure and not calling
the functions directly.</p>
<p>To successfully implement an auxprop plugin there is only one
required function to implement, that is the <code class="docutils literal"><span class="pre">auxprop_lookup</span></code>
member of the <code class="docutils literal"><span class="pre">sasl_auxprop_plug_t</span></code>.  This is called
just after canonicalization of the username, with the canonicalized
username.  It can then do whatever lookups are necessary for any
of the requested auxiliary properties.</p>
</div>
</div>


          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="testing.html" class="btn btn-neutral float-right" title="Testing" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="programming.html" class="btn btn-neutral" title="Application Programmer’s Guide" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 1993-2016, The Cyrus Team.
    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.6 using a modified <a href="https://readthedocs.org">Read the Docs</a> <a href="https://github.com/snide/sphinx_rtd_theme">theme</a>.

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'../../',
            VERSION:'2.1.27',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true
        };
    </script>
      <script type="text/javascript" src="../../_static/jquery.js"></script>
      <script type="text/javascript" src="../../_static/underscore.js"></script>
      <script type="text/javascript" src="../../_static/doctools.js"></script>
      <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>

  

  
  
    <script type="text/javascript" src="../../_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
<!--      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      }); -->
  </script>
  
 



</body>
</html>