関数 | |
static BOOL | is_samr_lsa_pipe (const char *pipe_name) |
BOOL | init_pipe_handle_list (pipes_struct *p, char *pipe_name) |
BOOL | create_policy_hnd (pipes_struct *p, POLICY_HND *hnd, void(*free_fn)(void *), void *data_ptr) |
static struct policy * | find_policy_by_hnd_internal (pipes_struct *p, POLICY_HND *hnd, void **data_p) |
BOOL | find_policy_by_hnd (pipes_struct *p, POLICY_HND *hnd, void **data_p) |
BOOL | close_policy_hnd (pipes_struct *p, POLICY_HND *hnd) |
void | close_policy_by_pipe (pipes_struct *p) |
BOOL | pipe_access_check (pipes_struct *p) |
static BOOL is_samr_lsa_pipe | ( | const char * | pipe_name | ) | [static] |
BOOL init_pipe_handle_list | ( | pipes_struct * | p, | |
char * | pipe_name | |||
) |
srv_lsa_hnd.c の 48 行で定義されています。
参照先 get_first_internal_pipe()・get_next_internal_pipe()・is_samr_lsa_pipe()・pipes_struct::name・pipes_struct::pipe_handles・handle_list::pipe_ref_count・smb_panic()・strequal().
参照元 make_internal_rpc_pipe_p().
00049 { 00050 pipes_struct *plist = get_first_internal_pipe(); 00051 struct handle_list *hl = NULL; 00052 00053 for (plist = get_first_internal_pipe(); plist; plist = get_next_internal_pipe(plist)) { 00054 if (strequal( plist->name, pipe_name) || 00055 (is_samr_lsa_pipe(plist->name) && is_samr_lsa_pipe(pipe_name))) { 00056 if (!plist->pipe_handles) { 00057 pstring msg; 00058 slprintf(msg, sizeof(msg)-1, "init_pipe_handles: NULL pipe_handle pointer in pipe %s", 00059 pipe_name ); 00060 smb_panic(msg); 00061 } 00062 hl = plist->pipe_handles; 00063 break; 00064 } 00065 } 00066 00067 if (!hl) { 00068 /* 00069 * No handle list for this pipe (first open of pipe). 00070 * Create list. 00071 */ 00072 00073 if ((hl = SMB_MALLOC_P(struct handle_list)) == NULL) 00074 return False; 00075 ZERO_STRUCTP(hl); 00076 00077 DEBUG(10,("init_pipe_handles: created handle list for pipe %s\n", pipe_name )); 00078 } 00079 00080 /* 00081 * One more pipe is using this list. 00082 */ 00083 00084 hl->pipe_ref_count++; 00085 00086 /* 00087 * Point this pipe at this list. 00088 */ 00089 00090 p->pipe_handles = hl; 00091 00092 DEBUG(10,("init_pipe_handles: pipe_handles ref count = %lu for pipe %s\n", 00093 (unsigned long)p->pipe_handles->pipe_ref_count, pipe_name )); 00094 00095 return True; 00096 }
BOOL create_policy_hnd | ( | pipes_struct * | p, | |
POLICY_HND * | hnd, | |||
void(*)(void *) | free_fn, | |||
void * | data_ptr | |||
) |
srv_lsa_hnd.c の 102 行で定義されています。
参照先 GUID::clock_seq・handle_list::count・dump_data()・policy_handle::handle_type・GUID::node・pipes_struct::pipe_handles・pol・handle_list::Policy・sys_getpid()・t・GUID::time_hi_and_version・GUID::time_low・GUID::time_mid・policy_handle::uuid.
参照元 _lsa_create_account()・_lsa_open_account()・_lsa_open_policy()・_lsa_open_policy2()・_samr_connect()・_samr_connect4()・_samr_connect5()・_samr_connect_anon()・_samr_create_dom_alias()・_samr_create_dom_group()・_samr_create_user()・_samr_open_alias()・_samr_open_domain()・_samr_open_group()・_samr_open_user()・create_open_service_handle()・elog_open()・open_printer_hnd()・open_registry_key().
00103 { 00104 static uint32 pol_hnd_low = 0; 00105 static uint32 pol_hnd_high = 0; 00106 time_t t = time(NULL); 00107 00108 struct policy *pol; 00109 00110 if (p->pipe_handles->count > MAX_OPEN_POLS) { 00111 DEBUG(0,("create_policy_hnd: ERROR: too many handles (%d) on this pipe.\n", 00112 (int)p->pipe_handles->count)); 00113 return False; 00114 } 00115 00116 pol = SMB_MALLOC_P(struct policy); 00117 if (!pol) { 00118 DEBUG(0,("create_policy_hnd: ERROR: out of memory!\n")); 00119 return False; 00120 } 00121 00122 ZERO_STRUCTP(pol); 00123 00124 pol->data_ptr = data_ptr; 00125 pol->free_fn = free_fn; 00126 00127 pol_hnd_low++; 00128 if (pol_hnd_low == 0) 00129 (pol_hnd_high)++; 00130 00131 SIVAL(&pol->pol_hnd.handle_type, 0 , 0); /* first bit must be null */ 00132 SIVAL(&pol->pol_hnd.uuid.time_low, 0 , pol_hnd_low ); /* second bit is incrementing */ 00133 SSVAL(&pol->pol_hnd.uuid.time_mid, 0 , pol_hnd_high); /* second bit is incrementing */ 00134 SSVAL(&pol->pol_hnd.uuid.time_hi_and_version, 0 , (pol_hnd_high>>16)); /* second bit is incrementing */ 00135 00136 /* split the current time into two 16 bit values */ 00137 00138 SSVAL(pol->pol_hnd.uuid.clock_seq, 0, (t>>16)); /* something random */ 00139 SSVAL(pol->pol_hnd.uuid.node, 0, t); /* something random */ 00140 00141 SIVAL(pol->pol_hnd.uuid.node, 2, sys_getpid()); /* something more random */ 00142 00143 DLIST_ADD(p->pipe_handles->Policy, pol); 00144 p->pipe_handles->count++; 00145 00146 *hnd = pol->pol_hnd; 00147 00148 DEBUG(4,("Opened policy hnd[%d] ", (int)p->pipe_handles->count)); 00149 dump_data(4, (char *)hnd, sizeof(*hnd)); 00150 00151 return True; 00152 }
static struct policy* find_policy_by_hnd_internal | ( | pipes_struct * | p, | |
POLICY_HND * | hnd, | |||
void ** | data_p | |||
) | [static] |
srv_lsa_hnd.c の 158 行で定義されています。
参照先 pipes_struct::bad_handle_fault_state・dump_data()・pipes_struct::pipe_handles・pol・handle_list::Policy.
参照元 close_policy_hnd()・find_policy_by_hnd().
00159 { 00160 struct policy *pol; 00161 size_t i; 00162 00163 if (data_p) 00164 *data_p = NULL; 00165 00166 for (i = 0, pol=p->pipe_handles->Policy;pol;pol=pol->next, i++) { 00167 if (memcmp(&pol->pol_hnd, hnd, sizeof(*hnd)) == 0) { 00168 DEBUG(4,("Found policy hnd[%d] ", (int)i)); 00169 dump_data(4, (char *)hnd, sizeof(*hnd)); 00170 if (data_p) 00171 *data_p = pol->data_ptr; 00172 return pol; 00173 } 00174 } 00175 00176 DEBUG(4,("Policy not found: ")); 00177 dump_data(4, (char *)hnd, sizeof(*hnd)); 00178 00179 p->bad_handle_fault_state = True; 00180 00181 return NULL; 00182 }
BOOL find_policy_by_hnd | ( | pipes_struct * | p, | |
POLICY_HND * | hnd, | |||
void ** | data_p | |||
) |
srv_lsa_hnd.c の 188 行で定義されています。
参照先 find_policy_by_hnd_internal().
参照元 _lsa_add_acct_rights()・_lsa_addprivs()・_lsa_close()・_lsa_create_account()・_lsa_enum_accounts()・_lsa_enum_acct_rights()・_lsa_enum_privs()・_lsa_enum_privsaccount()・_lsa_enum_trust_dom()・_lsa_getsystemaccount()・_lsa_lookup_names()・_lsa_lookup_names2()・_lsa_lookup_names3()・_lsa_lookup_priv_value()・_lsa_lookup_sids()・_lsa_lookup_sids2()・_lsa_open_account()・_lsa_priv_get_dispname()・_lsa_query_info()・_lsa_query_info2()・_lsa_query_secobj()・_lsa_remove_acct_rights()・_lsa_removeprivs()・_lsa_setsystemaccount()・_samr_enum_dom_aliases()・_samr_enum_dom_groups()・_samr_enum_dom_users()・_samr_enum_domains()・_samr_get_dispenum_index()・_samr_get_usrdom_pwinfo()・_samr_lookup_domain()・_samr_open_domain()・_samr_query_dispinfo()・_samr_query_domain_info()・_samr_query_useraliases()・_samr_query_userinfo()・_samr_set_dom_info()・find_eventlog_info_by_hnd()・find_printer_index_by_hnd()・find_regkey_index_by_hnd()・find_service_info_by_hnd()・get_lsa_policy_samr_sid().
00189 { 00190 return find_policy_by_hnd_internal(p, hnd, data_p) == NULL ? False : True; 00191 }
BOOL close_policy_hnd | ( | pipes_struct * | p, | |
POLICY_HND * | hnd | |||
) |
srv_lsa_hnd.c の 197 行で定義されています。
参照先 handle_list::count・find_policy_by_hnd_internal()・pipes_struct::pipe_handles・pol・handle_list::Policy.
参照元 _lsa_close()・_samr_close_hnd()・_samr_delete_dom_alias()・_samr_delete_dom_group()・_samr_delete_dom_user()・_svcctl_close_service()・_svcctl_unlock_service_db()・close_policy_by_pipe()・close_printer_handle()・close_registry_key()・elog_close().
00198 { 00199 struct policy *pol = find_policy_by_hnd_internal(p, hnd, NULL); 00200 00201 if (!pol) { 00202 DEBUG(3,("Error closing policy\n")); 00203 return False; 00204 } 00205 00206 DEBUG(3,("Closed policy\n")); 00207 00208 if (pol->free_fn && pol->data_ptr) 00209 (*pol->free_fn)(pol->data_ptr); 00210 00211 p->pipe_handles->count--; 00212 00213 DLIST_REMOVE(p->pipe_handles->Policy, pol); 00214 00215 ZERO_STRUCTP(pol); 00216 00217 SAFE_FREE(pol); 00218 00219 return True; 00220 }
void close_policy_by_pipe | ( | pipes_struct * | p | ) |
srv_lsa_hnd.c の 226 行で定義されています。
参照先 close_policy_hnd()・handle_list::count・pipes_struct::name・pipes_struct::pipe_handles・handle_list::pipe_ref_count・policy::pol_hnd・handle_list::Policy.
参照元 close_internal_rpc_pipe_hnd()・make_internal_rpc_pipe_p().
00227 { 00228 p->pipe_handles->pipe_ref_count--; 00229 00230 if (p->pipe_handles->pipe_ref_count == 0) { 00231 /* 00232 * Last pipe open on this list - free the list. 00233 */ 00234 while (p->pipe_handles->Policy) 00235 close_policy_hnd(p, &p->pipe_handles->Policy->pol_hnd); 00236 00237 p->pipe_handles->Policy = NULL; 00238 p->pipe_handles->count = 0; 00239 00240 SAFE_FREE(p->pipe_handles); 00241 DEBUG(10,("close_policy_by_pipe: deleted handle list for pipe %s\n", p->name )); 00242 } 00243 }
BOOL pipe_access_check | ( | pipes_struct * | p | ) |
srv_lsa_hnd.c の 253 行で定義されています。
参照先 pipes_struct::auth・pipe_auth_data::auth_type・get_valid_user_struct()・user_struct::guest・PIPE_AUTH_TYPE_SCHANNEL・pipes_struct::pipe_bound・pipes_struct::vuid.
参照元 _samr_connect()・_samr_connect4()・_samr_connect5()・_samr_connect_anon()・_samr_get_dom_pwinfo()・_srv_net_share_enum()・_srv_net_share_enum_all()・_srv_net_srv_get_info().
00254 { 00255 /* Don't let anonymous users access this RPC if restrict 00256 anonymous > 0 */ 00257 00258 if (lp_restrict_anonymous() > 0) { 00259 user_struct *user = get_valid_user_struct(p->vuid); 00260 00261 /* schannel, so we must be ok */ 00262 if (p->pipe_bound && (p->auth.auth_type == PIPE_AUTH_TYPE_SCHANNEL)) { 00263 return True; 00264 } 00265 00266 if (!user) { 00267 DEBUG(3, ("invalid vuid %d\n", p->vuid)); 00268 return False; 00269 } 00270 00271 if (user->guest) { 00272 return False; 00273 } 00274 } 00275 00276 return True; 00277 }