Annotation of 43BSDReno/contrib/isode-beta/doc/manual/passwd-init.tex, revision 1.1.1.1

1.1       root        1: \File{passwd\-init.c},{19:46},{Oct 14 1989}
                      2: \L{\LB{\C{}\/* lookup.c \- password lookup service \-\- initiator *\/\CE{}}}
                      3: \L{\LB{}}
                      4: \L{\LB{\K{\#include} \<stdio.h\>}}
                      5: \L{\LB{\K{\#include} \S{}\"ryinitiator.h\"\SE{}}\Tab{40}{\C{}\/* for generic interctive initiators *\/\CE{}}}
                      6: \L{\LB{\K{\#include} \S{}\"PasswordLookup\-ops.h\"\SE{}}\Tab{40}{\C{}\/* operation definitions *\/\CE{}}}
                      7: \L{\LB{\K{\#include} \S{}\"PasswordLookup\-types.h\"\SE{}}\Tab{40}{\C{}\/* type definitions *\/\CE{}}}
                      8: \L{\LB{}}
                      9: \L{\LB{\C{}\/* DATA *\/\CE{}}}
                     10: \L{\LB{}}
                     11: \L{\LB{\K{static} \K{char} *myservice = \S{}\"passwdstore\"\SE{};}}
                     12: \L{\LB{}}
                     13: \L{\LB{\K{static} \K{char} *mycontext = \S{}\"isode passwd lookup demo\"\SE{};}}
                     14: \L{\LB{\K{static} \K{char} *mypci = \S{}\"isode passwd lookup demo pci\"\SE{};}}
                     15: \L{\LB{}}
                     16: \L{\LB{}}
                     17: \L{\LB{}\Tab{40}{\C{}\/* ARGUMENTS *\/\CE{}}}
                     18: \L{\LB{\K{int}}\Tab{8}{do\_lookupUser (), do\_lookupUID (), do\_help (), do\_quit ();}}
                     19: \L{\LB{}}
                     20: \L{\LB{}\Tab{40}{\C{}\/* RESULTS *\/\CE{}}}
                     21: \L{\LB{\K{int}}\Tab{8}{lookup\_result ();}}
                     22: \L{\LB{}}
                     23: \L{\LB{}\Tab{40}{\C{}\/* ERRORS *\/\CE{}}}
                     24: \L{\LB{\K{int}}\Tab{8}{lookup\_error ();}}
                     25: \L{\LB{}}
                     26: \L{\LB{}}
                     27: \L{\LB{\K{static} \K{struct} dispatch dispatches[] = \{}}
                     28: \L{\LB{    \S{}\"lookupUser\"\SE{}, operation\_PasswordLookup\_lookupUser,}}
                     29: \L{\LB{    do\_lookupUser, free\_PasswordLookup\_UserName,}}
                     30: \L{\LB{    lookup\_result, lookup\_error,}}
                     31: \L{\LB{    \S{}\"find user by name\"\SE{},}}
                     32: \L{\LB{}}
                     33: \L{\LB{    \S{}\"lookupUID\"\SE{}, operation\_PasswordLookup\_lookupUID,}}
                     34: \L{\LB{    do\_lookupUID, free\_PasswordLookup\_UserID,}}
                     35: \L{\LB{    lookup\_result, lookup\_error,}}
                     36: \L{\LB{    \S{}\"find user by id\"\SE{},}}
                     37: \L{\LB{}}
                     38: \L{\LB{    \S{}\"help\"\SE{}, 0,}}
                     39: \L{\LB{    do\_help, NULLIFP,}}
                     40: \L{\LB{    NULLIFP, NULLIFP,}}
                     41: \L{\LB{    \S{}\"print this information\"\SE{},}}
                     42: \L{\LB{}}
                     43: \L{\LB{    \S{}\"quit\"\SE{}, 0,}}
                     44: \L{\LB{    do\_quit, NULLIFP,}}
                     45: \L{\LB{    NULLIFP, NULLIFP,}}
                     46: \L{\LB{    \S{}\"terminate the association and exit\"\SE{},}}
                     47: \L{\LB{}}
                     48: \L{\LB{    NULL}}
                     49: \L{\LB{\};}}
                     50: \L{\LB{}}
                     51: \L{\LB{\C{}\/* MAIN *\/\CE{}}}
                     52: \L{\LB{}}
                     53: \L{\LB{\C{}\/* ARGSUSED *\/\CE{}}}
                     54: \L{\LB{}}
                     55: \L{\LB{\Proc{main}main (argc, argv, envp)}}
                     56: \L{\LB{\K{int}}\Tab{8}{argc;}}
                     57: \L{\LB{\K{char}  **argv,}}
                     58: \L{\LB{      **envp;}}
                     59: \L{\LB{\{}}
                     60: \L{\LB{    (\K{void}) ryinitiator (argc, argv, myservice, mycontext, mypci,}}
                     61: \L{\LB{}\Tab{24}{table\_PasswordLookup\_Operations, dispatches, do\_quit);}}
                     62: \L{\LB{}}
                     63: \L{\LB{    exit (0);}\Tab{32}{\C{}\/* NOTREACHED *\/\CE{}}}
                     64: \L{\LB{\}}}
                     65: \L{\LB{}}
                     66: \L{\LB{\C{}\/* ARGUMENTS *\/\CE{}}}
                     67: \L{\LB{}}
                     68: \L{\LB{\C{}\/* ARGSUSED *\/\CE{}}}
                     69: \L{\LB{}}
                     70: \L{\LB{\K{static} \K{int}  do\_lookupUser (sd, ds, args, arg)}}
                     71: \L{\LB{\K{int}}\Tab{8}{sd;}}
                     72: \L{\LB{\K{struct} dispatch *ds;}}
                     73: \L{\LB{\K{char}  **args;}}
                     74: \L{\LB{\K{register} \K{struct} type\_PasswordLookup\_UserName **arg;}}
                     75: \L{\LB{\{}}
                     76: \L{\LB{    \K{char}   *cp;}}
                     77: \L{\LB{}}
                     78: \L{\LB{    \K{if} ((cp = *args++) == NULL) \{}}
                     79: \L{\LB{}\Tab{8}{advise (NULLCP, \S{}\"usage: lookupUser username\"\SE{});}}
                     80: \L{\LB{}\Tab{8}{\K{return} NOTOK;}}
                     81: \L{\LB{    \}}}
                     82: \L{\LB{}}
                     83: \L{\LB{    \K{if} ((*arg = str2qb (cp, strlen (cp), 1)) == NULL)}}
                     84: \L{\LB{}\Tab{8}{    adios (NULLCP, \S{}\"out of memory\"\SE{});}}
                     85: \L{\LB{}}
                     86: \L{\LB{    \K{return} OK;}}
                     87: \L{\LB{\}}}
                     88: \L{\LB{}}
                     89: \L{\LB{\C{}\/*  *\/\CE{}}}
                     90: \L{\LB{}}
                     91: \L{\LB{\C{}\/* ARGSUSED *\/\CE{}}}
                     92: \L{\LB{}}
                     93: \L{\LB{\K{static} \K{int}  do\_lookupUID (sd, ds, args, arg)}}
                     94: \L{\LB{\K{int}}\Tab{8}{sd;}}
                     95: \L{\LB{\K{struct} dispatch *ds;}}
                     96: \L{\LB{\K{char}  **args;}}
                     97: \L{\LB{\K{register} \K{struct} type\_PasswordLookup\_UserID **arg;}}
                     98: \L{\LB{\{}}
                     99: \L{\LB{    \K{char}   *cp;}}
                    100: \L{\LB{}}
                    101: \L{\LB{    \K{if} ((cp = *args++) == NULL) \{}}
                    102: \L{\LB{}\Tab{8}{advise (NULLCP, \S{}\"usage: lookupUID userid\"\SE{});}}
                    103: \L{\LB{}\Tab{8}{\K{return} NOTOK;}}
                    104: \L{\LB{    \}}}
                    105: \L{\LB{}}
                    106: \L{\LB{    \K{if} ((*arg = (\K{struct} type\_PasswordLookup\_UserID *) calloc (1, \K{sizeof} **arg))}}
                    107: \L{\LB{}\Tab{8}{    == NULL)}}
                    108: \L{\LB{}\Tab{8}{adios (NULLCP, \S{}\"out of memory\"\SE{});}}
                    109: \L{\LB{}}
                    110: \L{\LB{    (*arg) \-\> parm = atoi (cp);}}
                    111: \L{\LB{}}
                    112: \L{\LB{    \K{return} OK;}}
                    113: \L{\LB{\}}}
                    114: \L{\LB{}}
                    115: \L{\LB{\C{}\/*  *\/\CE{}}}
                    116: \L{\LB{}}
                    117: \L{\LB{\C{}\/* ARGSUSED *\/\CE{}}}
                    118: \L{\LB{}}
                    119: \L{\LB{\K{static} \K{int}  do\_help (sd, ds, args, dummy)}}
                    120: \L{\LB{\K{int}}\Tab{8}{sd;}}
                    121: \L{\LB{\K{register} \K{struct} dispatch *ds;}}
                    122: \L{\LB{\K{char}  **args;}}
                    123: \L{\LB{caddr\_t *dummy;}}
                    124: \L{\LB{\{}}
                    125: \L{\LB{    printf (\S{}\"\!nCommands are:\!n\"\SE{});}}
                    126: \L{\LB{    \K{for} (ds = dispatches; ds \-\> ds\_name; ds++)}}
                    127: \L{\LB{}\Tab{8}{printf (\S{}\"\%s\!t\%s\!n\"\SE{}, ds \-\> ds\_name, ds \-\> ds\_help);}}
                    128: \L{\LB{}}
                    129: \L{\LB{    \K{return} NOTOK;}}
                    130: \L{\LB{\}}}
                    131: \L{\LB{}}
                    132: \L{\LB{\C{}\/*  *\/\CE{}}}
                    133: \L{\LB{}}
                    134: \L{\LB{\C{}\/* ARGSUSED *\/\CE{}}}
                    135: \L{\LB{}}
                    136: \L{\LB{\K{static} \K{int}  do\_quit (sd, ds, args, dummy)}}
                    137: \L{\LB{\K{int}}\Tab{8}{sd;}}
                    138: \L{\LB{\K{struct} dispatch *ds;}}
                    139: \L{\LB{\K{char}  **args;}}
                    140: \L{\LB{caddr\_t *dummy;}}
                    141: \L{\LB{\{}}
                    142: \L{\LB{    \K{struct} AcSAPrelease acrs;}}
                    143: \L{\LB{    \K{register} \K{struct} AcSAPrelease   *acr = \&acrs;}}
                    144: \L{\LB{    \K{struct} AcSAPindication  acis;}}
                    145: \L{\LB{    \K{register} \K{struct} AcSAPindication *aci = \&acis;}}
                    146: \L{\LB{    \K{register} \K{struct} AcSAPabort *aca = \&aci \-\> aci\_abort;}}
                    147: \L{\LB{}}
                    148: \L{\LB{    \K{if} (AcRelRequest (sd, ACF\_NORMAL, NULLPEP, 0, NOTOK, acr, aci) == NOTOK)}}
                    149: \L{\LB{}\Tab{8}{acs\_adios (aca, \S{}\"A\-RELEASE.REQUEST\"\SE{});}}
                    150: \L{\LB{}}
                    151: \L{\LB{    \K{if} (!acr \-\> acr\_affirmative) \{}}
                    152: \L{\LB{}\Tab{8}{(\K{void}) AcUAbortRequest (sd, NULLPEP, 0, aci);}}
                    153: \L{\LB{}\Tab{8}{adios (NULLCP, \S{}\"release rejected by peer: \%d\"\SE{}, acr \-\> acr\_reason);}}
                    154: \L{\LB{    \}}}
                    155: \L{\LB{}}
                    156: \L{\LB{    ACRFREE (acr);}}
                    157: \L{\LB{}}
                    158: \L{\LB{    exit (0);}}
                    159: \L{\LB{\}}}
                    160: \L{\LB{}}
                    161: \L{\LB{\C{}\/* RESULTS *\/\CE{}}}
                    162: \L{\LB{}}
                    163: \L{\LB{\C{}\/* ARGSUSED *\/\CE{}}}
                    164: \L{\LB{}}
                    165: \L{\LB{\K{static} \K{int}  lookup\_result (sd, id, dummy, result, roi)}}
                    166: \L{\LB{\K{int}}\Tab{8}{sd,}}
                    167: \L{\LB{    }\Tab{8}{id,}}
                    168: \L{\LB{    }\Tab{8}{dummy;}}
                    169: \L{\LB{\K{register} \K{struct} type\_PasswordLookup\_Passwd *result;}}
                    170: \L{\LB{\K{struct} RoSAPindication *roi;}}
                    171: \L{\LB{\{}}
                    172: \L{\LB{    print\_qb (result \-\> name);}}
                    173: \L{\LB{    putchar (\S{}\':\'\SE{});}}
                    174: \L{\LB{    print\_qb (result \-\> passwd);}}
                    175: \L{\LB{    printf (\S{}\":\%d:\%d:\"\SE{}, result \-\> uid \-\> parm, result \-\> gid \-\> parm);}}
                    176: \L{\LB{    print\_qb (result \-\> gecos);}}
                    177: \L{\LB{    putchar (\S{}\':\'\SE{});}}
                    178: \L{\LB{    print\_qb (result \-\> dir);}}
                    179: \L{\LB{    putchar (\S{}\':\'\SE{});}}
                    180: \L{\LB{    print\_qb (result \-\> shell);}}
                    181: \L{\LB{    putchar (\S{}\'\!n\'\SE{});}}
                    182: \L{\LB{}}
                    183: \L{\LB{    \K{return} OK;}}
                    184: \L{\LB{\}}}
                    185: \L{\LB{}}
                    186: \L{\LB{}}
                    187: \L{\LB{\K{static}}\Tab{8}{print\_qb (q)}}
                    188: \L{\LB{\K{register} \K{struct} qbuf *q;}}
                    189: \L{\LB{\{}}
                    190: \L{\LB{    \K{register} \K{struct} qbuf *p;}}
                    191: \L{\LB{}}
                    192: \L{\LB{    \K{if} (q == NULL)}}
                    193: \L{\LB{}\Tab{8}{\K{return};}}
                    194: \L{\LB{}}
                    195: \L{\LB{    \K{for} (p = q \-\> qb\_forw; p != q; p = p \-\> qb\_forw)}}
                    196: \L{\LB{}\Tab{8}{printf (\S{}\"\%*.*s\"\SE{}, p \-\> qb\_len, p \-\> qb\_len, p \-\> qb\_data);}}
                    197: \L{\LB{\}}}
                    198: \L{\LB{}}
                    199: \L{\LB{\C{}\/* ERRORS *\/\CE{}}}
                    200: \L{\LB{}}
                    201: \L{\LB{\C{}\/* ARGSUSED *\/\CE{}}}
                    202: \L{\LB{}}
                    203: \L{\LB{\K{static} \K{int}  lookup\_error (sd, id, error, parameter, roi)}}
                    204: \L{\LB{\K{int}}\Tab{8}{sd,}}
                    205: \L{\LB{}\Tab{8}{id,}}
                    206: \L{\LB{    }\Tab{8}{error;}}
                    207: \L{\LB{caddr\_t parameter;}}
                    208: \L{\LB{\K{struct} RoSAPindication *roi;}}
                    209: \L{\LB{\{    }}
                    210: \L{\LB{    \K{register} \K{struct} RyError *rye;}}
                    211: \L{\LB{}}
                    212: \L{\LB{    \K{if} (error == RY\_REJECT) \{}}
                    213: \L{\LB{}\Tab{8}{advise (NULLCP, \S{}\"\%s\"\SE{}, RoErrString ((\K{int}) parameter));}}
                    214: \L{\LB{}\Tab{8}{\K{return} OK;}}
                    215: \L{\LB{    \}}}
                    216: \L{\LB{}}
                    217: \L{\LB{    \K{if} (rye = finderrbyerr (table\_PasswordLookup\_Errors, error))}}
                    218: \L{\LB{}\Tab{8}{advise (NULLCP, \S{}\"\%s\"\SE{},  rye \-\> rye\_name);}}
                    219: \L{\LB{    \K{else}}}
                    220: \L{\LB{}\Tab{8}{advise (NULLCP, \S{}\"Error \%d\"\SE{}, error);}}
                    221: \L{\LB{}}
                    222: \L{\LB{    \K{return} OK;}}
                    223: \L{\LB{\}}}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.