Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / afsadmsvr / TaAfsAdmSvrClientGroup.cpp
blob5a8af4296aa352bbf159d32403230a98cb067d15
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
10 #include <winsock2.h>
11 #include <ws2tcpip.h>
13 extern "C" {
14 #include <afs/param.h>
15 #include <afs/stds.h>
18 #include "TaAfsAdmSvrClientInternal.h"
22 * ROUTINES ___________________________________________________________________
26 BOOL ADMINAPI asc_GroupChange (UINT_PTR idClient, ASID idCell, ASID idGroup, LPAFSADMSVR_CHANGEGROUP_PARAMS pChange, ULONG *pStatus)
28 BOOL rc = TRUE;
29 ULONG status = 0;
31 RpcTryExcept
33 if ((rc = AfsAdmSvr_ChangeGroup (idClient, idCell, idGroup, pChange, &status)) != FALSE)
35 // If we succeeded in changing this group's properties, get the
36 // newest values for our cache.
38 ASOBJPROP Properties;
39 rc = asc_ObjectPropertiesGet (idClient, GET_ALL_DATA, idCell, idGroup, &Properties, &status);
42 RpcExcept(1)
44 rc = FALSE;
45 status = RPC_S_CALL_FAILED_DNE;
47 RpcEndExcept
49 if (!rc && pStatus)
50 *pStatus = status;
51 return rc;
55 BOOL ADMINAPI asc_GroupMembersGet (UINT_PTR idClient, ASID idCell, ASID idGroup, LPASIDLIST *ppAsidList, ULONG *pStatus)
57 BOOL rc = TRUE;
58 ULONG status = 0;
60 RpcTryExcept
62 rc = AfsAdmSvr_GetGroupMembers (idClient, idCell, idGroup, ppAsidList, &status);
64 RpcExcept(1)
66 rc = FALSE;
67 status = RPC_S_CALL_FAILED_DNE;
69 RpcEndExcept
71 if (!rc && pStatus)
72 *pStatus = status;
73 return rc;
77 BOOL ADMINAPI asc_GroupMemberAdd (UINT_PTR idClient, ASID idCell, ASID idGroup, ASID idMember, ULONG *pStatus)
79 BOOL rc = TRUE;
80 ULONG status = 0;
82 RpcTryExcept
84 rc = AfsAdmSvr_AddGroupMember (idClient, idCell, idGroup, idMember, &status);
86 RpcExcept(1)
88 rc = FALSE;
89 status = RPC_S_CALL_FAILED_DNE;
91 RpcEndExcept
93 if (!rc && pStatus)
94 *pStatus = status;
95 return rc;
99 BOOL ADMINAPI asc_GroupMemberRemove (UINT_PTR idClient, ASID idCell, ASID idGroup, ASID idMember, ULONG *pStatus)
101 BOOL rc = TRUE;
102 ULONG status = 0;
104 RpcTryExcept
106 rc = AfsAdmSvr_RemoveGroupMember (idClient, idCell, idGroup, idMember, &status);
108 RpcExcept(1)
110 rc = FALSE;
111 status = RPC_S_CALL_FAILED_DNE;
113 RpcEndExcept
115 if (!rc && pStatus)
116 *pStatus = status;
117 return rc;
121 BOOL ADMINAPI asc_GroupRename (UINT_PTR idClient, ASID idCell, ASID idGroup, LPCTSTR pszNewName, ULONG *pStatus)
123 BOOL rc = TRUE;
124 ULONG status = 0;
126 RpcTryExcept
128 STRING szNewName = TEXT("");
129 if (pszNewName)
130 lstrcpy (szNewName, pszNewName);
131 if ((rc = AfsAdmSvr_RenameGroup (idClient, idCell, idGroup, szNewName, &status)) == TRUE)
133 // If we succeeded in changing this group's name, get the
134 // newest group properties for our cache.
136 ASOBJPROP Properties;
137 rc = asc_ObjectPropertiesGet (idClient, GET_ALL_DATA, idCell, idGroup, &Properties, &status);
140 RpcExcept(1)
142 rc = FALSE;
143 status = RPC_S_CALL_FAILED_DNE;
145 RpcEndExcept
147 if (!rc && pStatus)
148 *pStatus = status;
149 return rc;
153 BOOL ADMINAPI asc_GroupMembershipGet (UINT_PTR idClient, ASID idCell, ASID idMember, LPASIDLIST *ppAsidList, ULONG *pStatus)
155 BOOL rc = TRUE;
156 ULONG status = 0;
158 RpcTryExcept
160 rc = AfsAdmSvr_GetGroupMembership (idClient, idCell, idMember, ppAsidList, &status);
162 RpcExcept(1)
164 rc = FALSE;
165 status = RPC_S_CALL_FAILED_DNE;
167 RpcEndExcept
169 if (!rc && pStatus)
170 *pStatus = status;
171 return rc;
175 BOOL ADMINAPI asc_GroupOwnershipGet (UINT_PTR idClient, ASID idCell, ASID idOwner, LPASIDLIST *ppAsidList, ULONG *pStatus)
177 BOOL rc = TRUE;
178 ULONG status = 0;
180 RpcTryExcept
182 rc = AfsAdmSvr_GetGroupOwnership (idClient, idCell, idOwner, ppAsidList, &status);
184 RpcExcept(1)
186 rc = FALSE;
187 status = RPC_S_CALL_FAILED_DNE;
189 RpcEndExcept
191 if (!rc && pStatus)
192 *pStatus = status;
193 return rc;
197 BOOL ADMINAPI asc_GroupCreate (UINT_PTR idClient, ASID idCell, LPAFSADMSVR_CREATEGROUP_PARAMS pCreate, ASID *pidGroup, ULONG *pStatus)
199 BOOL rc = TRUE;
200 ULONG status = 0;
202 RpcTryExcept
204 if ((rc = AfsAdmSvr_CreateGroup (idClient, idCell, pCreate, pidGroup, &status)) == TRUE)
206 // If we succeeded in creating this group, get the
207 // initial group properties for our cache.
209 ASOBJPROP Properties;
210 rc = asc_ObjectPropertiesGet (idClient, GET_ALL_DATA, idCell, *pidGroup, &Properties, &status);
213 RpcExcept(1)
215 rc = FALSE;
216 status = RPC_S_CALL_FAILED_DNE;
218 RpcEndExcept
220 if (!rc && pStatus)
221 *pStatus = status;
222 return rc;
226 BOOL ADMINAPI asc_GroupDelete (UINT_PTR idClient, ASID idCell, ASID idGroup, ULONG *pStatus)
228 BOOL rc = TRUE;
229 ULONG status = 0;
231 RpcTryExcept
233 if ((rc = AfsAdmSvr_DeleteGroup (idClient, idCell, idGroup, &status)) == TRUE)
235 // If we succeeded in deleting this group, clean up our cache.
236 // Expect this call to fail (the group's deleted, right?)
238 ASOBJPROP Properties;
239 ULONG dummy;
240 (void)asc_ObjectPropertiesGet (idClient, GET_ALL_DATA, idCell, idGroup, &Properties, &dummy);
243 RpcExcept(1)
245 rc = FALSE;
246 status = RPC_S_CALL_FAILED_DNE;
248 RpcEndExcept
250 if (!rc && pStatus)
251 *pStatus = status;
252 return rc;