source: trunk/athena/bin/aklog/aklog_param.c @ 5323

Revision 5323, 2.5 KB checked in by probe, 33 years ago (diff)
Added copyright notice
Line 
1/*
2 * $Id: aklog_param.c,v 1.6 1991-07-16 06:25:25 probe Exp $
3 *
4 * Copyright 1990,1991 by the Massachusetts Institute of Technology
5 * For distribution and copying rights, see the file "mit-copyright.h"
6 */
7
8#if !defined(lint) && !defined(SABER)
9static char *rcsid = "$Id: aklog_param.c,v 1.6 1991-07-16 06:25:25 probe Exp $";
10#endif /* lint || SABER */
11
12#include "aklog.h"
13#include <sys/types.h>
14#include <sys/stat.h>
15#include <krb.h>
16
17#ifndef TRUE
18#define TRUE 1
19#endif
20
21#ifndef FALSE
22#define FALSE 0
23#endif
24
25extern int readlink ARGS((char *, char *, int));
26extern int lstat ARGS((char *, struct stat *));
27extern char *getwd ARGS((char *));
28
29
30#ifdef __STDC__
31static int isdir(char *path, unsigned char *val)
32#else
33static int isdir(path, val)
34  char *path;
35  unsigned char *val;
36#endif /* __STDC__ */
37{
38    struct stat statbuf;
39
40    if (lstat(path, &statbuf) < 0)
41        return (-1);
42    else {
43        if ((statbuf.st_mode & S_IFMT) == S_IFDIR)
44            *val = TRUE;
45        else
46            *val = FALSE;
47        return (0);
48    } 
49}
50
51
52#ifdef __STDC__
53static int get_cred(char *name, char *inst, char *realm, CREDENTIALS *c)
54#else
55static int get_cred(name, inst, realm, c)
56  char *name;
57  char *inst;
58  char *realm;
59  CREDENTIALS *c;
60#endif /* __STDC__ */
61{
62    int status;
63
64    status = krb_get_cred(name, inst, realm, c);
65    if (status != KSUCCESS) {
66        status = get_ad_tkt(name, inst, realm, 255);
67        if (status == KSUCCESS)
68            status = krb_get_cred(name, inst, realm, c);
69    }
70
71    return (status);
72}
73
74
75#ifdef __STDC__
76static int get_user_realm(char *realm)
77#else
78static int get_user_realm(realm)
79  char *realm;
80#endif /* __STDC__ */
81{
82    return (krb_get_tf_realm(TKT_FILE, realm));
83}
84
85
86#ifdef __STDC__
87static void pstderr(char *string)
88#else
89static void pstderr(string)
90  char *string;
91#endif /* __STDC__ */
92{
93    write(2, string, strlen(string));
94}
95
96
97#ifdef __STDC__
98static void pstdout(char *string)
99#else
100static void pstdout(string)
101  char *string;
102#endif /* __STDC__ */
103{
104    write(1, string, strlen(string));
105}
106
107
108#ifdef __STDC__
109static void exitprog(char status)
110#else
111static void exitprog(status)
112  char status;
113#endif /* __STDC__ */
114{
115    exit(status);
116}
117
118
119#ifdef __STDC__
120void aklog_init_params(aklog_params *params)
121#else
122void aklog_init_params(params)
123  aklog_params *params;
124#endif /* __STDC__ */
125{
126    params->readlink = readlink;
127    params->isdir = isdir;
128    params->getwd = getwd;
129    params->get_cred = get_cred;
130    params->get_user_realm = get_user_realm;
131    params->pstderr = pstderr;
132    params->pstdout = pstdout;
133    params->exitprog = exitprog;
134}
Note: See TracBrowser for help on using the repository browser.