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

1.1     ! root        1: \File{passwd\-resp.c},{21:34},{Aug 31 1988}
        !             2: \L{\LB{\C{}\/* lookup\_service.c \- password lookup service \-\- responder *\/\CE{}}}
        !             3: \L{\LB{}}
        !             4: \L{\LB{\K{\#include} \<stdio.h\>}}
        !             5: \L{\LB{\K{\#include} \<pwd.h\>}}
        !             6: \L{\LB{\K{\#include} \S{}\"ryresponder.h\"\SE{}}\Tab{40}{\C{}\/* for generic idempotent responders *\/\CE{}}}
        !             7: \L{\LB{\K{\#include} \S{}\"PasswordLookup\-ops.h\"\SE{}}\Tab{40}{\C{}\/* operation definitions *\/\CE{}}}
        !             8: \L{\LB{\K{\#include} \S{}\"PasswordLookup\-types.h\"\SE{}}\Tab{40}{\C{}\/* type definitions *\/\CE{}}}
        !             9: \L{\LB{}}
        !            10: \L{\LB{}}
        !            11: \L{\LB{\K{\#define}}\Tab{8}{xalloc(p, type) \!}}
        !            12: \L{\LB{}\Tab{8}{((p) = (type) calloc (1, \K{sizeof} *(p)))}}
        !            13: \L{\LB{}}
        !            14: \L{\LB{\K{\#define}}\Tab{8}{salloc(s) \!}}
        !            15: \L{\LB{}\Tab{8}{str2qb ((s), strlen (s), 1)}}
        !            16: \L{\LB{}}
        !            17: \L{\LB{}}
        !            18: \L{\LB{\K{\#ifdef}}\Tab{8}{SYS5}}
        !            19: \L{\LB{\K{struct} passwd *getpwnam (), *getpwuid ();}}
        !            20: \L{\LB{\K{\#endif}}}
        !            21: \L{\LB{}}
        !            22: \L{\LB{}}
        !            23: \L{\LB{\C{}\/* DATA *\/\CE{}}}
        !            24: \L{\LB{}}
        !            25: \L{\LB{\K{static} \K{char} *myservice = \S{}\"passwdstore\"\SE{};}}
        !            26: \L{\LB{}}
        !            27: \L{\LB{}}
        !            28: \L{\LB{}\Tab{40}{\C{}\/* OPERATIONS *\/\CE{}}}
        !            29: \L{\LB{\K{int}}\Tab{8}{op\_lookupUser (), op\_lookupUID ();}}
        !            30: \L{\LB{}}
        !            31: \L{\LB{\K{static} \K{struct} dispatch dispatches[] = \{}}
        !            32: \L{\LB{    \S{}\"lookupUser\"\SE{}, operation\_PasswordLookup\_lookupUser, op\_lookupUser,}}
        !            33: \L{\LB{}}
        !            34: \L{\LB{    \S{}\"lookupUID\"\SE{}, operation\_PasswordLookup\_lookupUID, op\_lookupUID,}}
        !            35: \L{\LB{}}
        !            36: \L{\LB{    NULL}}
        !            37: \L{\LB{\};}}
        !            38: \L{\LB{}}
        !            39: \L{\LB{}}
        !            40: \L{\LB{\C{}\/* MAIN *\/\CE{}}}
        !            41: \L{\LB{}}
        !            42: \L{\LB{\C{}\/* ARGSUSED *\/\CE{}}}
        !            43: \L{\LB{}}
        !            44: \L{\LB{\Proc{main}main (argc, argv, envp)}}
        !            45: \L{\LB{\K{int}}\Tab{8}{argc;}}
        !            46: \L{\LB{\K{char}  **argv,}}
        !            47: \L{\LB{      **envp;}}
        !            48: \L{\LB{\{}}
        !            49: \L{\LB{    ryresponder (argc, argv, PLocalHostName (), myservice, dispatches,}}
        !            50: \L{\LB{}\Tab{8}{table\_PasswordLookup\_Operations, NULLIFP, NULLIFP);}}
        !            51: \L{\LB{}}
        !            52: \L{\LB{    exit (0);}\Tab{32}{\C{}\/* NOTREACHED *\/\CE{}}}
        !            53: \L{\LB{\}}}
        !            54: \L{\LB{}}
        !            55: \L{\LB{}}
        !            56: \L{\LB{\C{}\/* OPERATIONS *\/\CE{}}}
        !            57: \L{\LB{}}
        !            58: \L{\LB{\K{static} \K{int}  op\_lookupUser (sd, ryo, rox, in, roi)}}
        !            59: \L{\LB{\K{int}}\Tab{8}{sd;}}
        !            60: \L{\LB{\K{struct} RyOperation *ryo;}}
        !            61: \L{\LB{\K{struct} RoSAPinvoke *rox;}}
        !            62: \L{\LB{caddr\_t}\Tab{8}{in;}}
        !            63: \L{\LB{\K{struct} RoSAPindication *roi;}}
        !            64: \L{\LB{\{}}
        !            65: \L{\LB{    \K{int}     result;}}
        !            66: \L{\LB{    \K{char}   *cp;}}
        !            67: \L{\LB{    \K{register} \K{struct} type\_PasswordLookup\_UserName   *arg =}}
        !            68: \L{\LB{}\Tab{16}{(\K{struct} type\_PasswordLookup\_UserName   *) in;}}
        !            69: \L{\LB{}}
        !            70: \L{\LB{    \K{if} (rox \-\> rox\_nolinked == 0) \{}}
        !            71: \L{\LB{}\Tab{8}{advise (LLOG\_NOTICE, NULLCP,}}
        !            72: \L{\LB{}\Tab{16}{\S{}\"RO\-INVOKE.INDICATION\/\%d: \%s, unknown linkage \%d\"\SE{},}}
        !            73: \L{\LB{}\Tab{16}{sd, ryo \-\> ryo\_name, rox \-\> rox\_linkid);}}
        !            74: \L{\LB{}\Tab{8}{\K{return} ureject (sd, ROS\_IP\_LINKED, rox, roi);}}
        !            75: \L{\LB{    \}}}
        !            76: \L{\LB{    \K{if} (debug)}}
        !            77: \L{\LB{}\Tab{8}{advise (LLOG\_DEBUG, NULLCP, \S{}\"RO\-INVOKE.INDICATION\/\%d: \%s\"\SE{},}}
        !            78: \L{\LB{}\Tab{16}{sd, ryo \-\> ryo\_name);}}
        !            79: \L{\LB{}}
        !            80: \L{\LB{    \K{if} ((cp = qb2str (arg)) == NULL)}}
        !            81: \L{\LB{}\Tab{8}{result = error (sd, error\_PasswordLookup\_congested, (caddr\_t) NULL,}}
        !            82: \L{\LB{}\Tab{24}{rox, roi);}}
        !            83: \L{\LB{    \K{else} \{}}
        !            84: \L{\LB{}\Tab{8}{result = lookup (sd, getpwnam (cp), rox, roi);}}
        !            85: \L{\LB{}\Tab{8}{free (cp);}}
        !            86: \L{\LB{    \}}}
        !            87: \L{\LB{}}
        !            88: \L{\LB{    \K{return} result;}}
        !            89: \L{\LB{\}}}
        !            90: \L{\LB{}}
        !            91: \L{\LB{}}
        !            92: \L{\LB{\K{static} \K{int}  op\_lookupUID (sd, ryo, rox, in, roi)}}
        !            93: \L{\LB{\K{int}}\Tab{8}{sd;}}
        !            94: \L{\LB{\K{struct} RyOperation *ryo;}}
        !            95: \L{\LB{\K{struct} RoSAPinvoke *rox;}}
        !            96: \L{\LB{caddr\_t}\Tab{8}{in;}}
        !            97: \L{\LB{\K{struct} RoSAPindication *roi;}}
        !            98: \L{\LB{\{}}
        !            99: \L{\LB{    \K{register} \K{struct} type\_PasswordLookup\_UserID   *arg =}}
        !           100: \L{\LB{}\Tab{16}{(\K{struct} type\_PasswordLookup\_UserID   *) in;}}
        !           101: \L{\LB{}}
        !           102: \L{\LB{    \K{if} (rox \-\> rox\_nolinked == 0) \{}}
        !           103: \L{\LB{}\Tab{8}{advise (LLOG\_EXCEPTIONS, NULLCP,}}
        !           104: \L{\LB{}\Tab{16}{\S{}\"RO\-INVOKE.INDICATION\/\%d: \%s, unknown linkage \%d\"\SE{},}}
        !           105: \L{\LB{}\Tab{16}{sd, ryo \-\> ryo\_name, rox \-\> rox\_linkid);}}
        !           106: \L{\LB{}\Tab{8}{\K{return} ureject (sd, ROS\_IP\_LINKED, rox, roi);}}
        !           107: \L{\LB{    \}}}
        !           108: \L{\LB{    \K{if} (debug)}}
        !           109: \L{\LB{}\Tab{8}{advise (LLOG\_DEBUG, NULLCP, \S{}\"RO\-INVOKE.INDICATION\/\%d: \%s\"\SE{},}}
        !           110: \L{\LB{}\Tab{16}{sd, ryo \-\> ryo\_name);}}
        !           111: \L{\LB{}}
        !           112: \L{\LB{    \K{return} lookup (sd, getpwuid (arg \-\> arg), rox, roi);}}
        !           113: \L{\LB{\}}}
        !           114: \L{\LB{}}
        !           115: \L{\LB{}}
        !           116: \L{\LB{\K{static} \K{int}  lookup (sd, pw, rox, roi)}}
        !           117: \L{\LB{\K{int}}\Tab{8}{sd;}}
        !           118: \L{\LB{\K{struct} passwd *pw;}}
        !           119: \L{\LB{\K{struct} RoSAPinvoke *rox;}}
        !           120: \L{\LB{\K{struct} RoSAPindication *roi;}}
        !           121: \L{\LB{\{}}
        !           122: \L{\LB{    \K{int}}\Tab{8}{    result;}}
        !           123: \L{\LB{}}
        !           124: \L{\LB{    \K{if} (pw) \{}}
        !           125: \L{\LB{}\Tab{8}{\K{register} \K{struct} type\_PasswordLookup\_Passwd *res = NULL;}}
        !           126: \L{\LB{}}
        !           127: \L{\LB{}\Tab{8}{\K{if} (xalloc (res, \K{struct} type\_PasswordLookup\_Passwd *) == NULL}}
        !           128: \L{\LB{}\Tab{16}{\|\| (res \-\> name = salloc (pw \-\> pw\_name)) == NULL}}
        !           129: \L{\LB{}\Tab{16}{\|\| (*pw \-\> pw\_passwd}}
        !           130: \L{\LB{}\Tab{24}{\&\& (res \-\> passwd = salloc (pw \-\> pw\_passwd)) == NULL)}}
        !           131: \L{\LB{}\Tab{16}{\|\| xalloc (res \-\> uid, \K{struct} type\_PasswordLookup\_UserID *)}}
        !           132: \L{\LB{}\Tab{24}{== NULL}}
        !           133: \L{\LB{}\Tab{16}{\|\| xalloc (res \-\> gid, \K{struct} type\_PasswordLookup\_GroupID *)}}
        !           134: \L{\LB{}\Tab{24}{== NULL}}
        !           135: \L{\LB{}\Tab{16}{\|\| (pw \-\> pw\_comment}}
        !           136: \L{\LB{}\Tab{24}{\&\& (res \-\> comment = salloc (pw \-\> pw\_comment))}}
        !           137: \L{\LB{}\Tab{32}{== NULL)}}
        !           138: \L{\LB{}\Tab{16}{\|\| (pw \-\> pw\_gecos}}
        !           139: \L{\LB{}\Tab{24}{\&\& (res \-\> gecos = salloc (pw \-\> pw\_gecos)) == NULL)}}
        !           140: \L{\LB{}\Tab{16}{\|\| (pw \-\> pw\_dir}}
        !           141: \L{\LB{}\Tab{24}{\&\& (res \-\> dir = salloc (pw \-\> pw\_dir)) == NULL)}}
        !           142: \L{\LB{}\Tab{16}{\|\| (pw \-\> pw\_shell}}
        !           143: \L{\LB{}\Tab{24}{\&\& (res \-\> shell = salloc (pw \-\> pw\_shell))}}
        !           144: \L{\LB{}\Tab{32}{    == NULL))}}
        !           145: \L{\LB{}\Tab{8}{    result = error (sd, error\_PasswordLookup\_congested, (caddr\_t) NULL,}}
        !           146: \L{\LB{}\Tab{16}{rox, roi);}}
        !           147: \L{\LB{}\Tab{8}{\K{else} \{}}
        !           148: \L{\LB{}\Tab{8}{    res \-\> uid \-\> arg = pw \-\> pw\_uid;}}
        !           149: \L{\LB{}\Tab{8}{    res \-\> gid \-\> arg = pw \-\> pw\_gid;}}
        !           150: \L{\LB{}\Tab{8}{    res \-\> quota = pw \-\> pw\_quota;}}
        !           151: \L{\LB{}}
        !           152: \L{\LB{}\Tab{8}{    \K{if} (RyDsResult (sd, rox \-\> rox\_id, (caddr\_t) res, ROS\_NOPRIO, roi)}}
        !           153: \L{\LB{}\Tab{16}{    == NOTOK)}}
        !           154: \L{\LB{}\Tab{16}{ros\_adios (\&roi \-\> roi\_preject, \S{}\"RESULT\"\SE{});}}
        !           155: \L{\LB{}\Tab{8}{    result = OK;}}
        !           156: \L{\LB{}\Tab{8}{\}}}
        !           157: \L{\LB{}}
        !           158: \L{\LB{}\Tab{8}{free\_PasswordLookup\_Passwd (res);}}
        !           159: \L{\LB{    \}}}
        !           160: \L{\LB{    \K{else}}}
        !           161: \L{\LB{}\Tab{8}{result = error (sd, error\_PasswordLookup\_noSuchUser, (caddr\_t) NULL,}}
        !           162: \L{\LB{}\Tab{16}{rox, roi);}}
        !           163: \L{\LB{}}
        !           164: \L{\LB{    \K{return} result;}}
        !           165: \L{\LB{\}}}
        !           166: \L{\LB{}}
        !           167: \L{\LB{}}
        !           168: \L{\LB{\C{}\/* ERROR *\/\CE{}}}
        !           169: \L{\LB{}}
        !           170: \L{\LB{\K{static} \K{int}  error (sd, err, param, rox, roi)}}
        !           171: \L{\LB{\K{int}}\Tab{8}{sd,}}
        !           172: \L{\LB{}\Tab{8}{err;}}
        !           173: \L{\LB{caddr\_t}\Tab{8}{param;}}
        !           174: \L{\LB{\K{struct} RoSAPinvoke *rox;}}
        !           175: \L{\LB{\K{struct} RoSAPindication *roi;}}
        !           176: \L{\LB{\{}}
        !           177: \L{\LB{    \K{if} (RyDsError (sd, rox \-\> rox\_id, err, param, ROS\_NOPRIO, roi) == NOTOK)}}
        !           178: \L{\LB{}\Tab{8}{ros\_adios (\&roi \-\> roi\_preject, \S{}\"ERROR\"\SE{});}}
        !           179: \L{\LB{}}
        !           180: \L{\LB{    \K{return} OK;}}
        !           181: \L{\LB{\}}}
        !           182: \L{\LB{}}
        !           183: \L{\LB{}}
        !           184: \L{\LB{\C{}\/* U\-REJECT *\/\CE{}}}
        !           185: \L{\LB{}}
        !           186: \L{\LB{\K{static} \K{int}  ureject (sd, reason, rox, roi)}}
        !           187: \L{\LB{\K{int}}\Tab{8}{sd,}}
        !           188: \L{\LB{}\Tab{8}{reason;}}
        !           189: \L{\LB{\K{struct} RoSAPinvoke *rox;}}
        !           190: \L{\LB{\K{struct} RoSAPindication *roi;}}
        !           191: \L{\LB{\{}}
        !           192: \L{\LB{    \K{if} (RyDsUReject (sd, rox \-\> rox\_id, reason, ROS\_NOPRIO, roi) == NOTOK)}}
        !           193: \L{\LB{}\Tab{8}{ros\_adios (\&roi \-\> roi\_preject, \S{}\"U\-REJECT\"\SE{});}}
        !           194: \L{\LB{}}
        !           195: \L{\LB{    \K{return} OK;}}
        !           196: \L{\LB{\}}}

unix.superglobalmegacorp.com

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