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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML
><HEAD
><link rel='stylesheet' type='text/css' href='manpage.css'>
<!-- $Id: auth_generic.sgml,v 1.1 2004/10/21 00:10:49 mrsam Exp $ -->
<!-- Copyright 2004 Double Precision, Inc. See COPYING for -->
<!-- distribution information. -->
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<link rel="icon" href="icon.gif" type="image/gif" />
<TITLE
>auth_generic</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><H1
><A
NAME="AUTH-GENERIC"
></A
>auth_generic</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN6"
></A
><H2
>Name</H2
>auth_generic -- Generic authentication request</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN9"
></A
><H2
>Synopsis</H2
><P
CLASS="LITERALLAYOUT"
>#include <courierauth.h></P
><DIV
CLASS="FUNCSYNOPSIS"
><P
></P
><A
NAME="AEN11"
></A
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int rc=<TT
CLASS="FUNCTION"
>auth_generic</TT
></CODE
>(const char *<TT
CLASS="PARAMETER"
><I
>service</I
></TT
>, const char *<TT
CLASS="PARAMETER"
><I
>authtype</I
></TT
>, const char *<TT
CLASS="PARAMETER"
><I
>authdata</I
></TT
>, int (*<TT
CLASS="PARAMETER"
><I
>callback_func</I
></TT
>)(struct authinfo *, void *), void *<TT
CLASS="PARAMETER"
><I
>callback_arg</I
></TT
>);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN25"
></A
><H2
>DESCRIPTION</H2
><P
><TT
CLASS="FUNCTION"
>auth_generic</TT
> processes a generic authentication request.
You do not want to use this function.
You really want to use
<A
HREF="auth_login.html"
TARGET="_top"
><SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>auth_login</SPAN
>(3)</SPAN
></A
>.
<TT
CLASS="PARAMETER"
><I
>service</I
></TT
> specifies which so-called "service" is
being authenticated; like <SPAN
CLASS="QUOTE"
>"imap"</SPAN
> or <SPAN
CLASS="QUOTE"
>"pop3"</SPAN
>.
<TT
CLASS="PARAMETER"
><I
>service</I
></TT
> may or may not be used by the Courier
authentication library's configured back-end module.</P
><P
><TT
CLASS="FUNCTION"
>authtype</TT
> specifies the format of the authentication
request.
Three authentication formats are defined in
<TT
CLASS="FILENAME"
>courierauth.h</TT
>:</P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="LITERAL"
>AUTHTYPE_LOGIN</TT
></DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>authdata</I
></TT
> contains the following string:
<SPAN
CLASS="QUOTE"
>"<VAR
CLASS="REPLACEABLE"
>userid</VAR
>\n<VAR
CLASS="REPLACEABLE"
>password</VAR
>\n"</SPAN
>.
That is, the userid being authenticated, an <ACRONYM
CLASS="ACRONYM"
>ASCII</ACRONYM
>
newline character, the password, and a second newline character.</P
></DD
><DT
><TT
CLASS="LITERAL"
>AUTHTYPE_CRAMMD5</TT
> or <TT
CLASS="LITERAL"
>AUTHTYPE_CRAMSHA1</TT
></DT
><DD
><P
>This format is used
with <ACRONYM
CLASS="ACRONYM"
>CRAM-MD5</ACRONYM
> or <ACRONYM
CLASS="ACRONYM"
>CRAM-SHA1</ACRONYM
>.
<TT
CLASS="PARAMETER"
><I
>authdata</I
></TT
> contains the following string:
<SPAN
CLASS="QUOTE"
>"<VAR
CLASS="REPLACEABLE"
>challenge</VAR
>\n<VAR
CLASS="REPLACEABLE"
>response</VAR
>\n"</SPAN
>.
<VAR
CLASS="REPLACEABLE"
>challenge</VAR
> is the base64-encoded challenge, which
is followed by an <ACRONYM
CLASS="ACRONYM"
>ASCII</ACRONYM
>
newline character.
<VAR
CLASS="REPLACEABLE"
>response</VAR
> is a base64-encoded string that's
followed by a second newline character.
The base64-encoded string consists of the responding userid, a space
character, then the response to the challenge expressed as hexadecimal
digits.</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN66"
></A
><H2
>RETURNS</H2
><P
><TT
CLASS="FUNCTION"
>callback_func</TT
> will be invoked if
<TT
CLASS="FUNCTION"
>auth_generic</TT
>
succeeds, and <TT
CLASS="FUNCTION"
>callback_func</TT
>'s return value becomes
the return value from <TT
CLASS="FUNCTION"
>auth_generic</TT
> (which should be 0, by convention).
<TT
CLASS="FUNCTION"
>callback_func</TT
> will not be invoked if an error occurs,
which is reported by a non-zero return value from <TT
CLASS="FUNCTION"
>auth_generic</TT
>.
By convention, a positive return value indicates an internal, temporary
failure, such as the authentication daemon process not running; a negative
return value indicates that this request was processed, but it failed.</P
><P
>The second argument to <TT
CLASS="FUNCTION"
>callback_func</TT
> will be
<TT
CLASS="FUNCTION"
>callback_arg</TT
>, which is not interpreted by this
function in any way.
The first argument will be a pointer to the following structure:</P
><A
NAME="AEN78"
></A
><BLOCKQUOTE
CLASS="BLOCKQUOTE"
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN79"
></A
><P
><B
>Example 1. struct authinfo</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>struct authinfo {
const char *sysusername;
const uid_t *sysuserid;
gid_t sysgroupid;
const char *homedir;
const char *address;
const char *fullname;
const char *maildir;
const char *quota;
const char *passwd;
const char *clearpasswd;
const char *options;
} ;</PRE
></TD
></TR
></TABLE
></DIV
></BLOCKQUOTE
><P
>Description of the above fields:</P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>address</DT
><DD
><P
>The authenticated login ID.</P
></DD
><DT
>sysusername</DT
><DD
><P
>The authenticated account's userid and groupid can be looked up in the
password file using <TT
CLASS="LITERAL"
>address</TT
>.
If this field is <TT
CLASS="LITERAL"
>NULL</TT
>, obtain the userid and the groupid from
<TT
CLASS="LITERAL"
>sysuserid</TT
> and <TT
CLASS="LITERAL"
>sysgroupid</TT
>.</P
></DD
><DT
>sysuserid</DT
><DD
><P
><TT
CLASS="LITERAL"
>sysuserid</TT
> may be <TT
CLASS="LITERAL"
>NULL</TT
> if
<TT
CLASS="LITERAL"
>sysusername</TT
> is initialized, otherwise it's a pointer to
the account's numeric userid.</P
></DD
><DT
>sysgroupid</DT
><DD
><P
>Account's numeric groupid.
<TT
CLASS="LITERAL"
>sysgroupid</TT
> is only used when <TT
CLASS="LITERAL"
>sysusername</TT
>
is <TT
CLASS="LITERAL"
>NULL</TT
>.</P
></DD
><DT
>fullname</DT
><DD
><P
>This is the account's full name.
This field is optional, it may be <TT
CLASS="LITERAL"
>NULL</TT
>.</P
></DD
><DT
>homedir</DT
><DD
><P
>The account's home directory.
This field cannot be <TT
CLASS="LITERAL"
>NULL</TT
>.</P
></DD
><DT
>maildir</DT
><DD
><P
>The pathname to the account's mailbox.
This field is optional, it can be <TT
CLASS="LITERAL"
>NULL</TT
> in which case the
default location is assumed.</P
></DD
><DT
>quota</DT
><DD
><P
>Optional maildir quota on the account's mailbox (and <TT
CLASS="LITERAL"
>NULL</TT
>
if no quota is set).</P
></DD
><DT
>passwd</DT
><DD
><P
>The account's encrypted password, if available.
If the account has a cleartext password defined, this field
can be set to <TT
CLASS="LITERAL"
>NULL</TT
>.
The encrypted password can take several formats:</P
><P
></P
><UL
><LI
><P
>A traditional triple-DES crypted password, or a MD5+salt-hashed password,
as used in Linux.</P
></LI
><LI
><P
><SPAN
CLASS="QUOTE"
>"{MD5}"</SPAN
> followed by a base64-encoded MD5 hash
of the password.</P
></LI
><LI
><P
><SPAN
CLASS="QUOTE"
>"{SHA}"</SPAN
> followed by a base64-encoded SHA1 hash
of the password.</P
></LI
></UL
></DD
><DT
>clearpasswd</DT
><DD
><P
>The account's cleartext password, if available.
If the account has an encrypted password defined, this field
can be set to <TT
CLASS="LITERAL"
>NULL</TT
>.</P
></DD
><DT
>options</DT
><DD
><P
>A comma-separated list of miscellaneous account options.
See below for more information.</P
></DD
></DL
></DIV
><DIV
CLASS="REFSECT2"
><A
NAME="AEN153"
></A
><H3
>Account options</H3
><P
>Depending on the configuration of the Courier authentication library,
accounts may have individual options associated with them.
If the authentication library configuration does not implement account
options, the option string will be <TT
CLASS="LITERAL"
>NULL</TT
>.
Otherwise it will be a comma-separated list of
<SPAN
CLASS="QUOTE"
>"<VAR
CLASS="REPLACEABLE"
>option</VAR
>=<VAR
CLASS="REPLACEABLE"
>value</VAR
>"</SPAN
>
settings.</P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
>NOTE:</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>This is the account option implementation
that's used by Courier, Courier-IMAP, and
SqWebMail packages. Some of the following information is obviously
not applicable for a particular package.
The inapplicable bits should be obvious.</P
></TD
></TR
></TABLE
></DIV
><P
>The following options are recognized by the various Courier
packages:</P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
>NOTE:</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>The application is responsible for enforcing all the <SPAN
CLASS="QUOTE"
>"disabled"</SPAN
>
option.
An authentication request for service <SPAN
CLASS="QUOTE"
>"imap"</SPAN
>, for example,
will succeed provided that the userid and the password are valid,
even if <SPAN
CLASS="QUOTE"
>"disableimap=1"</SPAN
> is set.
The application's <TT
CLASS="FUNCTION"
>callback_func</TT
> should check for this
condition, and return a negative return code.</P
></TD
></TR
></TABLE
></DIV
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="LITERAL"
>disableimap=</TT
><VAR
CLASS="REPLACEABLE"
>n</VAR
></DT
><DD
><P
>If "n" is 1, IMAP access to this account should be disabled.</P
></DD
><DT
><TT
CLASS="LITERAL"
>disablepop3=</TT
><VAR
CLASS="REPLACEABLE"
>n</VAR
></DT
><DD
><P
>If "n" is 1, POP3 access to this account should be disabled.</P
></DD
><DT
><TT
CLASS="LITERAL"
>disablewebmail=</TT
><VAR
CLASS="REPLACEABLE"
>n</VAR
></DT
><DD
><P
>If "n" is 1, webmail access to this account should be disabled.</P
></DD
><DT
><TT
CLASS="LITERAL"
>disableshared=</TT
><VAR
CLASS="REPLACEABLE"
>n</VAR
></DT
><DD
><P
>If "n" is 1, this account should not have access to shared folders or be able
to share its own folders with other people.</P
></DD
><DT
><TT
CLASS="LITERAL"
>group=</TT
><VAR
CLASS="REPLACEABLE"
>name</VAR
></DT
><DD
><P
>This account is a member of access group
<VAR
CLASS="REPLACEABLE"
>name</VAR
>.
Instead of granting access rights on individual mail folders to individual
accounts, the access rights can be granted to an access group
<SPAN
CLASS="QUOTE"
>"name"</SPAN
>, and all members of this group get the specified access
rights.</P
><P
>The access group name <SPAN
CLASS="QUOTE"
>"administrators"</SPAN
> is a reserved group.
All accounts in the <TT
CLASS="LITERAL"
>administrators</TT
> group automatically
receive all rights to all accessible folders.</P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="90%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
>NOTE:</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>This option may be specified multiple times to specify that the account
belongs to multiple account groups.</P
></TD
></TR
></TABLE
></DIV
></DD
><DT
><TT
CLASS="LITERAL"
>sharedgroup=</TT
><VAR
CLASS="REPLACEABLE"
>name</VAR
></DT
><DD
><P
>Append "name" to the name of the top level virtual shared folder
index file. This setting restricts which virtual shared folders this
account could possibly access (and that's on top of whatever else the
access control lists say). See the virtual shared folder documentation
for more information.</P
><P
>For technical reasons, group names may not include comma, tab, "/" or "|"
characters.</P
></DD
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN214"
></A
><H2
>SEE ALSO</H2
><P
><A
HREF="authlib.html"
TARGET="_top"
><SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>authlib</SPAN
>(3)</SPAN
></A
>,
<A
HREF="auth_login.html"
TARGET="_top"
><SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>auth_login</SPAN
>(3)</SPAN
></A
>,
<A
HREF="auth_getuserinfo.html"
TARGET="_top"
><SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>auth_getuserinfo</SPAN
>(3)</SPAN
></A
>,
<A
HREF="auth_enumerate.html"
TARGET="_top"
><SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>auth_enumerate</SPAN
>(3)</SPAN
></A
>,
<A
HREF="auth_passwd.html"
TARGET="_top"
><SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>auth_passwd</SPAN
>(3)</SPAN
></A
>,
<A
HREF="auth_getoption.html"
TARGET="_top"
><SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>auth_getoption</SPAN
>(3)</SPAN
></A
>.</P
></DIV
></BODY
></HTML
>
|