2 Unix SMB/CIFS implementation.
4 Winbind daemon - sid related functions
6 Copyright (C) Tim Potter 2000
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #define DBGC_CLASS DBGC_WINBIND
28 static void set_mapping_recv(void *private_data
, bool success
)
30 struct winbindd_cli_state
*state
=
31 talloc_get_type_abort(private_data
, struct winbindd_cli_state
);
34 DEBUG(5, ("Could not set sid mapping\n"));
42 void winbindd_set_mapping(struct winbindd_cli_state
*state
)
47 DEBUG(3, ("[%5lu]: set id map\n", (unsigned long)state
->pid
));
49 if ( ! state
->privileged
) {
50 DEBUG(0, ("Only root is allowed to set mappings!\n"));
55 if (!string_to_sid(&sid
, state
->request
->data
.dual_idmapset
.sid
)) {
56 DEBUG(1, ("Could not get convert sid %s from string\n",
57 state
->request
->data
.sid
));
63 map
.xid
.id
= state
->request
->data
.dual_idmapset
.id
;
64 map
.xid
.type
= state
->request
->data
.dual_idmapset
.type
;
66 winbindd_set_mapping_async(state
->mem_ctx
, &map
,
67 set_mapping_recv
, state
);
70 static void remove_mapping_recv(void *private_data
, bool success
)
72 struct winbindd_cli_state
*state
=
73 talloc_get_type_abort(private_data
, struct winbindd_cli_state
);
76 DEBUG(5, ("Could not remove sid mapping\n"));
84 void winbindd_remove_mapping(struct winbindd_cli_state
*state
)
89 DEBUG(3, ("[%5lu]: remove id map\n", (unsigned long)state
->pid
));
91 if ( ! state
->privileged
) {
92 DEBUG(0, ("Only root is allowed to remove mappings!\n"));
97 if (!string_to_sid(&sid
, state
->request
->data
.dual_idmapset
.sid
)) {
98 DEBUG(1, ("Could not get convert sid %s from string\n",
99 state
->request
->data
.sid
));
100 request_error(state
);
105 map
.xid
.id
= state
->request
->data
.dual_idmapset
.id
;
106 map
.xid
.type
= state
->request
->data
.dual_idmapset
.type
;
108 winbindd_remove_mapping_async(state
->mem_ctx
, &map
,
109 remove_mapping_recv
, state
);
112 static void set_hwm_recv(void *private_data
, bool success
)
114 struct winbindd_cli_state
*state
=
115 talloc_get_type_abort(private_data
, struct winbindd_cli_state
);
118 DEBUG(5, ("Could not set sid mapping\n"));
119 request_error(state
);
126 void winbindd_set_hwm(struct winbindd_cli_state
*state
)
130 DEBUG(3, ("[%5lu]: set hwm\n", (unsigned long)state
->pid
));
132 if ( ! state
->privileged
) {
133 DEBUG(0, ("Only root is allowed to set mappings!\n"));
134 request_error(state
);
138 xid
.id
= state
->request
->data
.dual_idmapset
.id
;
139 xid
.type
= state
->request
->data
.dual_idmapset
.type
;
141 winbindd_set_hwm_async(state
->mem_ctx
, &xid
, set_hwm_recv
, state
);