]>
Commit | Line | Data |
---|---|---|
04277e02 | 1 | /* Copyright (c) 1997-2019 Free Software Foundation, Inc. |
51702635 UD |
2 | This file is part of the GNU C Library. |
3 | Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. | |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
51702635 UD |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
51702635 | 14 | |
41bdb6e2 | 15 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
51702635 | 18 | |
ba9234d9 | 19 | #include <string.h> |
51702635 | 20 | #include <rpcsvc/nis.h> |
82f43dd2 | 21 | #include <shlib-compat.h> |
91eee4dd UD |
22 | |
23 | #include "nis_xdr.h" | |
51702635 UD |
24 | #include "nis_intern.h" |
25 | ||
26 | nis_result * | |
0292b0dd | 27 | nis_checkpoint (const_nis_name dirname) |
51702635 UD |
28 | { |
29 | nis_result *res; | |
30 | ||
31 | res = calloc (1, sizeof (nis_result)); | |
91eee4dd UD |
32 | if (res == NULL) |
33 | return NULL; | |
51702635 UD |
34 | |
35 | if (dirname != NULL) | |
36 | { | |
51702635 UD |
37 | nis_result *res2; |
38 | u_int i; | |
39 | ||
40 | res2 = nis_lookup (dirname, EXPAND_NAME); | |
dfd2257a | 41 | if (NIS_RES_STATUS (res2) != NIS_SUCCESS) |
843ede44 UD |
42 | { |
43 | free (res); | |
44 | return res2; | |
45 | } | |
51702635 UD |
46 | |
47 | /* Check if obj is really a diryectory object */ | |
dfd2257a | 48 | if (__type_of (NIS_RES_OBJECT (res2)) != NIS_DIRECTORY_OBJ) |
51702635 | 49 | { |
843ede44 | 50 | nis_freeresult (res2); |
dfd2257a | 51 | NIS_RES_STATUS (res) = NIS_INVALIDOBJ; |
51702635 UD |
52 | return res; |
53 | } | |
54 | ||
55 | for (i = 0; | |
dfd2257a | 56 | i < NIS_RES_OBJECT (res2)->DI_data.do_servers.do_servers_len; ++i) |
51702635 | 57 | { |
91eee4dd UD |
58 | cp_result cpres; |
59 | ||
60 | memset (&cpres, '\0', sizeof (cp_result)); | |
dfd2257a | 61 | if (__do_niscall2 (&NIS_RES_OBJECT(res2)->DI_data.do_servers.do_servers_val[i], |
91eee4dd UD |
62 | 1, NIS_CHECKPOINT, (xdrproc_t) _xdr_nis_name, |
63 | (caddr_t) &dirname, (xdrproc_t) _xdr_cp_result, | |
e852e889 | 64 | (caddr_t) &cpres, 0, NULL) != NIS_SUCCESS) |
dfd2257a | 65 | NIS_RES_STATUS (res) = NIS_RPCERROR; |
51702635 UD |
66 | else |
67 | { | |
91eee4dd UD |
68 | NIS_RES_STATUS (res) = cpres.cp_status; |
69 | res->zticks += cpres.cp_zticks; | |
70 | res->dticks += cpres.cp_dticks; | |
51702635 UD |
71 | } |
72 | } | |
73 | nis_freeresult (res2); | |
74 | } | |
75 | else | |
dfd2257a | 76 | NIS_RES_STATUS (res) = NIS_NOSUCHNAME; |
51702635 UD |
77 | |
78 | return res; | |
79 | } | |
1e4d83f6 | 80 | libnsl_hidden_nolink_def (nis_checkpoint, GLIBC_2_1) |