home *** CD-ROM | disk | FTP | other *** search
- /* PCNFSD functions
-
- ©1999 Joseph Walton
-
- This software is distributed under the terms of the GNU General Public
- License; either version 2 of the License, or (at your option) any
- later version.
- */
-
- /*
- Only one PCNFSD procedure is actually supported - auth.
- This may be of some use as it is, or it may be of use
- as a basis for further development.
- */
-
- #include "rpc.h"
- #include "pcnfsd.h"
-
- int pcnfsd_procedure(struct Call *call, int32 *ptr, int32 *limit,
- int32 *rptr, int32 *rlimit)
- {
- if (call->c_version != PCNFSD_VERSION) {
- *rptr++ = P_ENUM(PROG_MISMATCH);
- *rptr++ = P_UINT(PCNFSD_VERSION);
- *rptr = P_UINT(PCNFSD_VERSION);
- return 8;
- }
-
- switch (call->c_procedure) {
- case PCNFSD_PROC_NULL:
- *rptr = P_ENUM(SUCCESS);
- return 6;
-
- case PCNFSD_PROC_AUTH:
-
- /*
- This is what you'd do if you were going to do anything
- with the usercode and password supplied.
-
- char identBuffer[IDENTLEN + 1],
- pwBuffer[PASSWORDLEN + 1];
-
- ptr = getString(ptr, limit, identBuffer, sizeof(identBuffer));
- ptr = getString(ptr, limit, pwBuffer, sizeof(pwBuffer));
-
- if (!ptr) {
- *rptr++ = P_ENUM(GARBAGE_ARGS);
- return 6;
- }
-
- decode(indentBuffer);
- decode(pwBuffer);
- */
-
- /* Frankly, we're not bothered what they said */
- *rptr++ = P_ENUM(SUCCESS);
- *rptr++ = P_ENUM(AUTH_RES_FAKE);
- *rptr++ = P_UINT(UID_NOBODY);
- *rptr = P_UINT(GID_NOGROUP);
- return 9;
-
- default:
- *rptr = P_ENUM(PROC_UNAVAIL);
- return 6;
- }
- }
-
- /* The strings passed are encoded in a rather simple-minded fashion. */
- static void decode(STRPTR s)
- {
- while (*s) {
- *s++ = (*s ^ 0x5b) & 0x7f;
- }
- }
-
-