/* This is called from libnpclient user space. * It drives the client end of authentication. */ int diod_auth (Npcfid *afid, u32 uid) { int ret = -1; #if HAVE_LIBMUNGE char *cred = NULL; munge_ctx_t ctx = NULL; if (!(ctx = munge_ctx_create ())) { np_uerror (ENOMEM); goto done; } if (munge_encode (&cred, ctx, NULL, 0) != EMUNGE_SUCCESS) { np_uerror (EPERM); goto done; } if (npc_puts (afid, cred) < 0) { goto done; } ret = 0; done: if (ctx) munge_ctx_destroy (ctx); #endif return ret; }
int main() { curr_line = 0; curr_col = 0; for (;;) { npc_puts("nemu> "); for (;;) { char ch = npc_getc(); npc_putc(ch); if (ch == 'q') { return 0; } else if (ch == '\n') { break; } } } return 0; }