parse_net.c
来自「samba-3.0.22.tar.gz 编译smb服务器的源码」· C语言 代码 · 共 2,161 行 · 第 1/5 页
C
2,161 行
init_netinfo_1(&r_l->logon.info1, flags, pdc_status); r_l->status = NT_STATUS_OK; break; default: DEBUG(2,("init_r_logon_ctrl: unsupported switch value %d\n", r_l->switch_value)); r_l->ptr = 0; /* undocumented pointer */ /* take a guess at an error code... */ r_l->status = NT_STATUS_INVALID_INFO_CLASS; break; }}/******************************************************************* Reads or writes an NET_R_LOGON_CTRL structure.********************************************************************/BOOL net_io_r_logon_ctrl(const char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps, int depth){ prs_debug(ps, depth, desc, "net_io_r_logon_ctrl"); depth++; if(!prs_uint32("switch_value ", ps, depth, &r_l->switch_value)) return False; if(!prs_uint32("ptr ", ps, depth, &r_l->ptr)) return False; if (r_l->ptr != 0) { switch (r_l->switch_value) { case 1: if(!net_io_netinfo_1("", &r_l->logon.info1, ps, depth)) return False; break; default: DEBUG(2,("net_io_r_logon_ctrl: unsupported switch value %d\n", r_l->switch_value)); break; } } if(!prs_ntstatus("status ", ps, depth, &r_l->status)) return False; return True;}/******************************************************************* Inits an NET_R_GETDCNAME structure.********************************************************************/void init_net_q_getdcname(NET_Q_GETDCNAME *r_t, const char *logon_server, const char *domainname){ DEBUG(5,("init_r_getdcname\n")); r_t->ptr_logon_server = (logon_server != NULL); init_unistr2(&r_t->uni_logon_server, logon_server, UNI_STR_TERMINATE); r_t->ptr_domainname = (domainname != NULL); init_unistr2(&r_t->uni_domainname, domainname, UNI_STR_TERMINATE);}/******************************************************************* Reads or writes an NET_Q_GETDCNAME structure.********************************************************************/BOOL net_io_q_getdcname(const char *desc, NET_Q_GETDCNAME *r_t, prs_struct *ps, int depth){ if (r_t == NULL) return False; prs_debug(ps, depth, desc, "net_io_q_getdcname"); depth++; if (!prs_uint32("ptr_logon_server", ps, depth, &r_t->ptr_logon_server)) return False; if (!smb_io_unistr2("logon_server", &r_t->uni_logon_server, r_t->ptr_logon_server, ps, depth)) return False; if (!prs_align(ps)) return False; if (!prs_uint32("ptr_domainname", ps, depth, &r_t->ptr_domainname)) return False; if (!smb_io_unistr2("domainname", &r_t->uni_domainname, r_t->ptr_domainname, ps, depth)) return False; return True;}/******************************************************************* Inits an NET_R_GETDCNAME structure.********************************************************************/void init_net_r_getdcname(NET_R_GETDCNAME *r_t, const char *dcname){ DEBUG(5,("init_r_getdcname\n")); init_unistr2(&r_t->uni_dcname, dcname, UNI_STR_TERMINATE);}/******************************************************************* Reads or writes an NET_R_GETDCNAME structure.********************************************************************/BOOL net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps, int depth){ if (r_t == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_getdcname"); depth++; if (!prs_uint32("ptr_dcname", ps, depth, &r_t->ptr_dcname)) return False; if (!smb_io_unistr2("dcname", &r_t->uni_dcname, r_t->ptr_dcname, ps, depth)) return False; if (!prs_align(ps)) return False; if (!prs_ntstatus("status", ps, depth, &r_t->status)) return False; return True;}/******************************************************************* Inits an NET_R_TRUST_DOM_LIST structure.********************************************************************/void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, uint32 num_doms, const char *dom_name){ unsigned int i = 0; DEBUG(5,("init_r_trust_dom\n")); for (i = 0; i < MAX_TRUST_DOMS; i++) { r_t->uni_trust_dom_name[i].uni_str_len = 0; r_t->uni_trust_dom_name[i].uni_max_len = 0; } if (num_doms > MAX_TRUST_DOMS) num_doms = MAX_TRUST_DOMS; for (i = 0; i < num_doms; i++) { fstring domain_name; fstrcpy(domain_name, dom_name); strupper_m(domain_name); init_unistr2(&r_t->uni_trust_dom_name[i], domain_name, UNI_STR_TERMINATE); /* the use of UNISTR2 here is non-standard. */ r_t->uni_trust_dom_name[i].offset = 0x1; } r_t->status = NT_STATUS_OK;}/******************************************************************* Reads or writes an NET_R_TRUST_DOM_LIST structure.********************************************************************/BOOL net_io_r_trust_dom(const char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth){ uint32 value; if (r_t == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_trust_dom"); depth++; /* temporary code to give a valid response */ value=2; if(!prs_uint32("status", ps, depth, &value)) return False; value=1; if(!prs_uint32("status", ps, depth, &value)) return False; value=2; if(!prs_uint32("status", ps, depth, &value)) return False; value=0; if(!prs_uint32("status", ps, depth, &value)) return False; value=0; if(!prs_uint32("status", ps, depth, &value)) return False;/* old non working code */#if 0 int i; for (i = 0; i < MAX_TRUST_DOMS; i++) { if (r_t->uni_trust_dom_name[i].uni_str_len == 0) break; if(!smb_io_unistr2("", &r_t->uni_trust_dom_name[i], True, ps, depth)) return False; } if(!prs_ntstatus("status", ps, depth, &r_t->status)) return False;#endif return True;}/******************************************************************* Reads or writes an NET_Q_TRUST_DOM_LIST structure.********************************************************************/BOOL net_io_q_trust_dom(const char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, int depth){ if (q_l == NULL) return False; prs_debug(ps, depth, desc, "net_io_q_trust_dom"); depth++; if(!prs_uint32("ptr ", ps, depth, &q_l->ptr)) return False; if(!smb_io_unistr2 ("", &q_l->uni_server_name, q_l->ptr, ps, depth)) return False; return True;}/******************************************************************* Inits an NET_Q_REQ_CHAL structure.********************************************************************/void init_q_req_chal(NET_Q_REQ_CHAL *q_c, const char *logon_srv, const char *logon_clnt, const DOM_CHAL *clnt_chal){ DEBUG(5,("init_q_req_chal: %d\n", __LINE__)); q_c->undoc_buffer = 1; /* don't know what this buffer is */ init_unistr2(&q_c->uni_logon_srv, logon_srv , UNI_STR_TERMINATE); init_unistr2(&q_c->uni_logon_clnt, logon_clnt, UNI_STR_TERMINATE); memcpy(q_c->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data)); DEBUG(5,("init_q_req_chal: %d\n", __LINE__));}/******************************************************************* Reads or writes an NET_Q_REQ_CHAL structure.********************************************************************/BOOL net_io_q_req_chal(const char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth){ if (q_c == NULL) return False; prs_debug(ps, depth, desc, "net_io_q_req_chal"); depth++; if(!prs_align(ps)) return False; if(!prs_uint32("undoc_buffer", ps, depth, &q_c->undoc_buffer)) return False; if(!smb_io_unistr2("", &q_c->uni_logon_srv, True, ps, depth)) /* logon server unicode string */ return False; if(!smb_io_unistr2("", &q_c->uni_logon_clnt, True, ps, depth)) /* logon client unicode string */ return False; if(!smb_io_chal("", &q_c->clnt_chal, ps, depth)) return False; return True;}/******************************************************************* Reads or writes a structure.********************************************************************/BOOL net_io_r_req_chal(const char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth){ if (r_c == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_req_chal"); depth++; if(!prs_align(ps)) return False; if(!smb_io_chal("", &r_c->srv_chal, ps, depth)) /* server challenge */ return False; if(!prs_ntstatus("status", ps, depth, &r_c->status)) return False; return True;}/******************************************************************* Reads or writes a structure.********************************************************************/BOOL net_io_q_auth(const char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth){ if (q_a == NULL) return False; prs_debug(ps, depth, desc, "net_io_q_auth"); depth++; if(!prs_align(ps)) return False; if(!smb_io_log_info ("", &q_a->clnt_id, ps, depth)) /* client identification info */ return False; if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) return False; return True;}/******************************************************************* Reads or writes a structure.********************************************************************/BOOL net_io_r_auth(const char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth){ if (r_a == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_auth"); depth++; if(!prs_align(ps)) return False; if(!smb_io_chal("", &r_a->srv_chal, ps, depth)) /* server challenge */ return False; if(!prs_ntstatus("status", ps, depth, &r_a->status)) return False; return True;}/******************************************************************* Inits a NET_Q_AUTH_2 struct.********************************************************************/void init_q_auth_2(NET_Q_AUTH_2 *q_a, const char *logon_srv, const char *acct_name, uint16 sec_chan, const char *comp_name, const DOM_CHAL *clnt_chal, uint32 clnt_flgs){ DEBUG(5,("init_q_auth_2: %d\n", __LINE__)); init_log_info(&q_a->clnt_id, logon_srv, acct_name, sec_chan, comp_name); memcpy(q_a->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data)); q_a->clnt_flgs.neg_flags = clnt_flgs; DEBUG(5,("init_q_auth_2: %d\n", __LINE__));}/******************************************************************* Reads or writes a structure.********************************************************************/BOOL net_io_q_auth_2(const char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth){ if (q_a == NULL) return False; prs_debug(ps, depth, desc, "net_io_q_auth_2"); depth++; if(!prs_align(ps)) return False; if(!smb_io_log_info ("", &q_a->clnt_id, ps, depth)) /* client identification info */ return False; if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) return False; if(!net_io_neg_flags("", &q_a->clnt_flgs, ps, depth)) return False; return True;}/******************************************************************* Reads or writes a structure.********************************************************************/BOOL net_io_r_auth_2(const char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth){ if (r_a == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_auth_2"); depth++; if(!prs_align(ps)) return False; if(!smb_io_chal("", &r_a->srv_chal, ps, depth)) /* server challenge */ return False; if(!net_io_neg_flags("", &r_a->srv_flgs, ps, depth)) return False; if(!prs_ntstatus("status", ps, depth, &r_a->status)) return False; return True;}/******************************************************************* Inits a NET_Q_AUTH_3 struct.********************************************************************/void init_q_auth_3(NET_Q_AUTH_3 *q_a, const char *logon_srv, const char *acct_name, uint16 sec_chan, const char *comp_name, const DOM_CHAL *clnt_chal, uint32 clnt_flgs)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?