add missing semicolons
[Samba.git] / source / lib / util_nttoken.c
blob13c66a5f4507888f677617413e0af0d5228aae3a
1 /*
2 * Unix SMB/CIFS implementation.
3 * Authentication utility functions
4 * Copyright (C) Andrew Tridgell 1992-1998
5 * Copyright (C) Andrew Bartlett 2001
6 * Copyright (C) Jeremy Allison 2000-2001
7 * Copyright (C) Rafal Szczesniak 2002
8 * Copyright (C) Volker Lendecke 2006
9 * Copyright (C) Michael Adam 2007
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <http://www.gnu.org/licenses/>.
25 /* function(s) moved from auth/auth_util.c to minimize linker deps */
27 #include "includes.h"
29 /****************************************************************************
30 Duplicate a SID token.
31 ****************************************************************************/
33 NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, const NT_USER_TOKEN *ptoken)
35 NT_USER_TOKEN *token;
37 if (!ptoken)
38 return NULL;
40 token = TALLOC_P(mem_ctx, NT_USER_TOKEN);
41 if (token == NULL) {
42 DEBUG(0, ("talloc failed\n"));
43 return NULL;
46 ZERO_STRUCTP(token);
48 if (ptoken->user_sids && ptoken->num_sids) {
49 token->user_sids = (DOM_SID *)talloc_memdup(
50 token, ptoken->user_sids, sizeof(DOM_SID) * ptoken->num_sids );
52 if (token->user_sids == NULL) {
53 DEBUG(0, ("talloc_memdup failed\n"));
54 TALLOC_FREE(token);
55 return NULL;
57 token->num_sids = ptoken->num_sids;
60 /* copy the privileges; don't consider failure to be critical here */
62 if ( !se_priv_copy( &token->privileges, &ptoken->privileges ) ) {
63 DEBUG(0,("dup_nt_token: Failure to copy SE_PRIV!. "
64 "Continuing with 0 privileges assigned.\n"));
67 return token;