Changeset 745 for trunk/server/source3/passdb/machine_sid.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/passdb/machine_sid.c
r414 r745 6 6 Copyright (C) Gerald (Jerry) Carter 2000 7 7 Copyright (C) Stefan (metze) Metzmacher 2002 8 8 9 9 This program is free software; you can redistribute it and/or modify 10 10 it under the terms of the GNU General Public License as published by 11 11 the Free Software Foundation; either version 3 of the License, or 12 12 (at your option) any later version. 13 13 14 14 This program is distributed in the hope that it will be useful, 15 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 17 GNU General Public License for more details. 18 18 19 19 You should have received a copy of the GNU General Public License 20 20 along with this program. If not, see <http://www.gnu.org/licenses/>. … … 22 22 23 23 #include "includes.h" 24 #include "passdb.h" 25 #include "secrets.h" 26 #include "dbwrap.h" 27 #include "../libcli/security/security.h" 24 28 25 29 /* NOTE! the global_sam_sid is the SID of our local SAM. This is only 26 30 equal to the domain SID when we are a DC, otherwise its our 27 31 workstation SID */ 28 static DOM_SID*global_sam_sid=NULL;32 static struct dom_sid *global_sam_sid=NULL; 29 33 30 34 #undef DBGC_CLASS … … 36 40 ****************************************************************************/ 37 41 38 static bool read_sid_from_file(const char *fname, DOM_SID*sid)42 static bool read_sid_from_file(const char *fname, struct dom_sid *sid) 39 43 { 40 44 char **lines; … … 43 47 44 48 lines = file_lines_load(fname, &numlines,0, NULL); 45 49 46 50 if (!lines || numlines < 1) { 47 if (lines)TALLOC_FREE(lines);51 TALLOC_FREE(lines); 48 52 return False; 49 53 } 50 54 51 55 ret = string_to_sid(sid, lines[0]); 52 56 TALLOC_FREE(lines); … … 57 61 generate a random sid - used to build our own sid if we don't have one 58 62 */ 59 static void generate_random_sid( DOM_SID*sid)63 static void generate_random_sid(struct dom_sid *sid) 60 64 { 61 65 int i; 62 66 uchar raw_sid_data[12]; 63 67 64 memset((char *)sid, '\0', sizeof(*sid)); 68 ZERO_STRUCTP(sid); 69 65 70 sid->sid_rev_num = 1; 66 71 sid->id_auth[5] = 5; … … 77 82 ****************************************************************************/ 78 83 79 static DOM_SID*pdb_generate_sam_sid(void)80 { 81 DOM_SIDdomain_sid;84 static struct dom_sid *pdb_generate_sam_sid(void) 85 { 86 struct dom_sid domain_sid; 82 87 char *fname = NULL; 83 DOM_SID*sam_sid;84 85 if(!(sam_sid=SMB_MALLOC_P( DOM_SID)))88 struct dom_sid *sam_sid; 89 90 if(!(sam_sid=SMB_MALLOC_P(struct dom_sid))) 86 91 return NULL; 87 92 … … 111 116 } 112 117 113 if (! sid_equal(&domain_sid, sam_sid)) {118 if (!dom_sid_equal(&domain_sid, sam_sid)) { 114 119 115 120 /* Domain name sid doesn't match global sam sid. Re-store domain sid as 'local' sid. */ … … 125 130 126 131 return sam_sid; 127 128 132 } 129 133 … … 180 184 181 185 /* return our global_sam_sid */ 182 DOM_SID*get_global_sam_sid(void)186 struct dom_sid *get_global_sam_sid(void) 183 187 { 184 188 struct db_context *db; … … 186 190 if (global_sam_sid != NULL) 187 191 return global_sam_sid; 188 192 189 193 /* 190 194 * memory for global_sam_sid is allocated in … … 229 233 *****************************************************************/ 230 234 231 bool sid_check_is_domain(const DOM_SID*sid)232 { 233 return sid_equal(sid, get_global_sam_sid());235 bool sid_check_is_domain(const struct dom_sid *sid) 236 { 237 return dom_sid_equal(sid, get_global_sam_sid()); 234 238 } 235 239 … … 238 242 *****************************************************************/ 239 243 240 bool sid_check_is_in_our_domain(const DOM_SID *sid) 241 { 242 DOM_SID dom_sid; 243 uint32 rid; 244 bool sid_check_is_in_our_domain(const struct dom_sid *sid) 245 { 246 struct dom_sid dom_sid; 244 247 245 248 sid_copy(&dom_sid, sid); 246 sid_split_rid(&dom_sid, &rid);249 sid_split_rid(&dom_sid, NULL); 247 250 return sid_check_is_domain(&dom_sid); 248 251 }
Note:
See TracChangeset
for help on using the changeset viewer.