データ構造 | |
struct | con_struct |
関数 | |
static int | cs_destructor (struct con_struct *p) |
static struct con_struct * | create_cs (TALLOC_CTX *ctx, NTSTATUS *perr) |
NTSTATUS | net_lookup_name_from_sid (TALLOC_CTX *ctx, DOM_SID *psid, const char **ppdomain, const char **ppname) |
NTSTATUS | net_lookup_sid_from_name (TALLOC_CTX *ctx, const char *full_name, DOM_SID *pret_sid) |
変数 | |
static struct con_struct * | cs |
static int cs_destructor | ( | struct con_struct * | p | ) | [static] |
netlookup.c の 44 行で定義されています。
参照先 con_struct::cli・cli_shutdown()・cs.
参照元 create_cs().
00045 { 00046 if (cs->cli) { 00047 cli_shutdown(cs->cli); 00048 } 00049 cs = NULL; 00050 return 0; 00051 }
static struct con_struct* create_cs | ( | TALLOC_CTX * | ctx, | |
NTSTATUS * | perr | |||
) | [static] |
netlookup.c の 57 行で定義されています。
参照先 con_struct::cli・cli_full_connection()・cli_rpc_pipe_open_noauth()・cs・cs_destructor()・endif・con_struct::err・con_struct::failed_connect・global_myname・interpret_addr2()・con_struct::lsapipe・nt_errstr()・opt_machine_pass・opt_password・opt_user_name・opt_workgroup・con_struct::pol・rpccli_lsa_open_policy().
参照元 net_lookup_name_from_sid()・net_lookup_sid_from_name().
00058 { 00059 NTSTATUS nt_status; 00060 struct in_addr loopback_ip = *interpret_addr2("127.0.0.1"); 00061 00062 *perr = NT_STATUS_OK; 00063 00064 if (cs) { 00065 if (cs->failed_connect) { 00066 *perr = cs->err; 00067 return NULL; 00068 } 00069 return cs; 00070 } 00071 00072 cs = TALLOC_P(ctx, struct con_struct); 00073 if (!cs) { 00074 *perr = NT_STATUS_NO_MEMORY; 00075 return NULL; 00076 } 00077 00078 ZERO_STRUCTP(cs); 00079 talloc_set_destructor(cs, cs_destructor); 00080 00081 /* Connect to localhost with given username/password. */ 00082 /* JRA. Pretty sure we can just do this anonymously.... */ 00083 #if 0 00084 if (!opt_password && !opt_machine_pass) { 00085 char *pass = getpass("Password:"); 00086 if (pass) { 00087 opt_password = SMB_STRDUP(pass); 00088 } 00089 } 00090 #endif 00091 00092 nt_status = cli_full_connection(&cs->cli, global_myname(), global_myname(), 00093 &loopback_ip, 0, 00094 "IPC$", "IPC", 00095 #if 0 00096 opt_user_name, 00097 opt_workgroup, 00098 opt_password, 00099 #else 00100 "", 00101 opt_workgroup, 00102 "", 00103 #endif 00104 0, 00105 Undefined, 00106 NULL); 00107 00108 if (!NT_STATUS_IS_OK(nt_status)) { 00109 DEBUG(2,("create_cs: Connect failed. Error was %s\n", nt_errstr(nt_status))); 00110 cs->failed_connect = True; 00111 cs->err = nt_status; 00112 *perr = nt_status; 00113 return NULL; 00114 } 00115 00116 cs->lsapipe = cli_rpc_pipe_open_noauth(cs->cli, 00117 PI_LSARPC, 00118 &nt_status); 00119 00120 if (cs->lsapipe == NULL) { 00121 DEBUG(2,("create_cs: open LSA pipe failed. Error was %s\n", nt_errstr(nt_status))); 00122 cs->failed_connect = True; 00123 cs->err = nt_status; 00124 *perr = nt_status; 00125 return NULL; 00126 } 00127 00128 nt_status = rpccli_lsa_open_policy(cs->lsapipe, ctx, True, 00129 SEC_RIGHTS_MAXIMUM_ALLOWED, 00130 &cs->pol); 00131 00132 if (!NT_STATUS_IS_OK(nt_status)) { 00133 DEBUG(2,("create_cs: rpccli_lsa_open_policy failed. Error was %s\n", nt_errstr(nt_status))); 00134 cs->failed_connect = True; 00135 cs->err = nt_status; 00136 *perr = nt_status; 00137 return NULL; 00138 } 00139 00140 return cs; 00141 }
NTSTATUS net_lookup_name_from_sid | ( | TALLOC_CTX * | ctx, | |
DOM_SID * | psid, | |||
const char ** | ppdomain, | |||
const char ** | ppname | |||
) |
netlookup.c の 151 行で定義されています。
参照先 create_cs()・con_struct::lsapipe・con_struct::pol・rpccli_lsa_lookup_sids().
参照元 info_fn().
00155 { 00156 NTSTATUS nt_status; 00157 struct con_struct *csp = NULL; 00158 char **domains; 00159 char **names; 00160 enum lsa_SidType *types; 00161 00162 *ppdomain = NULL; 00163 *ppname = NULL; 00164 00165 csp = create_cs(ctx, &nt_status); 00166 if (csp == NULL) { 00167 return nt_status; 00168 } 00169 00170 nt_status = rpccli_lsa_lookup_sids(csp->lsapipe, ctx, 00171 &csp->pol, 00172 1, psid, 00173 &domains, 00174 &names, 00175 &types); 00176 00177 if (!NT_STATUS_IS_OK(nt_status)) { 00178 return nt_status; 00179 } 00180 00181 *ppdomain = domains[0]; 00182 *ppname = names[0]; 00183 /* Don't care about type here. */ 00184 00185 /* Converted OK */ 00186 return NT_STATUS_OK; 00187 }
NTSTATUS net_lookup_sid_from_name | ( | TALLOC_CTX * | ctx, | |
const char * | full_name, | |||
DOM_SID * | pret_sid | |||
) |
netlookup.c の 193 行で定義されています。
参照先 create_cs()・con_struct::lsapipe・con_struct::pol・rpccli_lsa_lookup_names().
参照元 net_usershare_add().
00194 { 00195 NTSTATUS nt_status; 00196 struct con_struct *csp = NULL; 00197 DOM_SID *sids = NULL; 00198 enum lsa_SidType *types = NULL; 00199 00200 csp = create_cs(ctx, &nt_status); 00201 if (csp == NULL) { 00202 return nt_status; 00203 } 00204 00205 nt_status = rpccli_lsa_lookup_names(csp->lsapipe, ctx, 00206 &csp->pol, 00207 1, 00208 &full_name, 00209 NULL, &sids, 00210 &types); 00211 00212 if (!NT_STATUS_IS_OK(nt_status)) { 00213 return nt_status; 00214 } 00215 00216 *pret_sid = sids[0]; 00217 00218 /* Converted OK */ 00219 return NT_STATUS_OK; 00220 }
struct con_struct* cs [static] |
netlookup.c の 38 行で定義されています。
参照元 count_current_connections()・count_fn()・create_cs()・cs_destructor().