NTSTATUS _net_logon_ctrl2(pipes_struct *p, NET_Q_LOGON_CTRL2 *q_u, NET_R_LOGON_CTRL2 *r_u) { uint32 flags = 0x0; uint32 pdc_connection_status = 0x0; uint32 logon_attempts = 0x0; uint32 tc_status = ERROR_NO_LOGON_SERVERS; const char *trusted_domain = "test_domain"; DEBUG(0, ("*** net long ctrl2 %d, %d, %d\n", q_u->function_code, q_u->query_level, q_u->switch_value)); DEBUG(6,("_net_logon_ctrl2: %d\n", __LINE__)); /* set up the Logon Control2 response */ init_net_r_logon_ctrl2(r_u, q_u->query_level, flags, pdc_connection_status, logon_attempts, tc_status, trusted_domain); if (lp_server_role() == ROLE_DOMAIN_BDC) send_sync_message(); DEBUG(6,("_net_logon_ctrl2: %d\n", __LINE__)); return r_u->status; }
int send_message(Router *router, Message *m) { int ret=0; assert(router && m); if(REQUEST == m->type) { GLIST(InputInterface) * iface_list; pthread_mutex_lock(&router->bindings_mutex); iface_list=&(router->comm_bindings[m->senderid].pattern_bindings[m->pattern_id]); if (Glist_empty(iface_list)) { /* There is no tool to honor this request so I do not accept this reqeust */ ret=1; /* ERROR */ } else { RequestTool rt; rt.toolid=m->senderid; rt.reqrepid=m->reqrepid; Glist_add(&router->request_tool_list, &rt, sizeof(RequestTool), (void *)requesttool_copyfunc); ret=0; } pthread_mutex_unlock(&router->bindings_mutex); } if(0 == ret) { if (SYNC_MODE == m->mode) ret=send_sync_message(router, m); else ret=mqueue_add(&router->mqueue, m)? 0 /* SUCCESS */ : 1 /* ERROR */; } return ret; }
NTSTATUS _net_logon_ctrl2(pipes_struct *p, NET_Q_LOGON_CTRL2 *q_u, NET_R_LOGON_CTRL2 *r_u) { uint32 flags = 0x0; uint32 pdc_connection_status = 0x0; uint32 logon_attempts = 0x0; uint32 tc_status; fstring servername, domain, dc_name, dc_name2; struct in_addr dc_ip; /* this should be \\global_myname() */ unistr2_to_ascii(servername, &q_u->uni_server_name, sizeof(servername)); r_u->status = NT_STATUS_OK; tc_status = ERROR_NO_SUCH_DOMAIN; fstrcpy( dc_name, "" ); switch ( q_u->function_code ) { case NETLOGON_CONTROL_TC_QUERY: unistr2_to_ascii(domain, &q_u->info.info6.domain, sizeof(domain)); if ( !is_trusted_domain( domain ) ) break; if ( !get_dc_name( domain, NULL, dc_name2, &dc_ip ) ) { tc_status = ERROR_NO_LOGON_SERVERS; break; } fstr_sprintf( dc_name, "\\\\%s", dc_name2 ); tc_status = NO_ERROR; break; case NETLOGON_CONTROL_REDISCOVER: unistr2_to_ascii(domain, &q_u->info.info6.domain, sizeof(domain)); if ( !is_trusted_domain( domain ) ) break; if ( !get_dc_name( domain, NULL, dc_name2, &dc_ip ) ) { tc_status = ERROR_NO_LOGON_SERVERS; break; } fstr_sprintf( dc_name, "\\\\%s", dc_name2 ); tc_status = NO_ERROR; break; default: /* no idea what this should be */ DEBUG(0,("_net_logon_ctrl2: unimplemented function level [%d]\n", q_u->function_code)); } /* prepare the response */ init_net_r_logon_ctrl2( r_u, q_u->query_level, flags, pdc_connection_status, logon_attempts, tc_status, dc_name ); if (lp_server_role() == ROLE_DOMAIN_BDC) send_sync_message(); return r_u->status; }