データ構造 | |
struct | sync_record |
関数 | |
static void | callback (const char *sname, uint32 stype, const char *comment, void *state) |
static void | sync_child (char *name, int nm_type, char *workgroup, struct in_addr ip, BOOL local, BOOL servers, char *fname) |
void | sync_browse_lists (struct work_record *work, char *name, int nm_type, struct in_addr ip, BOOL local, BOOL servers) |
static void | complete_one (struct sync_record *s, char *sname, uint32 stype, char *comment) |
static void | complete_sync (struct sync_record *s) |
void | sync_check_completion (void) |
変数 | |
fstring | local_machine |
static struct sync_record * | syncs |
static XFILE * | fp |
static void callback | ( | const char * | sname, | |
uint32 | stype, | |||
const char * | comment, | |||
void * | state | |||
) | [static] |
nmbd_synclists.c の 53 行で定義されています。
参照先 fp・x_fprintf().
参照元 py_tdb_hnd_traverse()・smb_readline_replacement()・sync_child()・talloc_report_depth_cb().
static void sync_child | ( | char * | name, | |
int | nm_type, | |||
char * | workgroup, | |||
struct in_addr | ip, | |||
BOOL | local, | |||
BOOL | servers, | |||
char * | fname | |||
) | [static] |
nmbd_synclists.c の 65 行で定義されています。
参照先 callback()・cli・cli_connect()・cli_initialise()・cli_negprot()・cli_NetServerEnum()・cli_send_tconX()・cli_session_request()・cli_session_setup()・cli_set_port()・cli_shutdown()・local_machine・make_nmb_name()・cli_state::server_domain・status.
参照元 sync_browse_lists().
00069 { 00070 fstring unix_workgroup; 00071 struct cli_state *cli; 00072 uint32 local_type = local ? SV_TYPE_LOCAL_LIST_ONLY : 0; 00073 struct nmb_name called, calling; 00074 NTSTATUS status; 00075 00076 /* W2K DMB's return empty browse lists on port 445. Use 139. 00077 * Patch from Andy Levine andyl@epicrealm.com. 00078 */ 00079 00080 cli = cli_initialise(); 00081 if (!cli) { 00082 return; 00083 } 00084 00085 if (!cli_set_port(cli, 139)) { 00086 return; 00087 } 00088 00089 status = cli_connect(cli, name, &ip); 00090 if (!NT_STATUS_IS_OK(status)) { 00091 return; 00092 } 00093 00094 make_nmb_name(&calling, local_machine, 0x0); 00095 make_nmb_name(&called , name, nm_type); 00096 00097 if (!cli_session_request(cli, &calling, &called)) { 00098 cli_shutdown(cli); 00099 return; 00100 } 00101 00102 if (!cli_negprot(cli)) { 00103 cli_shutdown(cli); 00104 return; 00105 } 00106 00107 if (!NT_STATUS_IS_OK(cli_session_setup(cli, "", "", 1, "", 0, 00108 workgroup))) { 00109 cli_shutdown(cli); 00110 return; 00111 } 00112 00113 if (!cli_send_tconX(cli, "IPC$", "IPC", "", 1)) { 00114 cli_shutdown(cli); 00115 return; 00116 } 00117 00118 /* All the cli_XX functions take UNIX character set. */ 00119 fstrcpy(unix_workgroup, cli->server_domain ? cli->server_domain : workgroup); 00120 00121 /* Fetch a workgroup list. */ 00122 cli_NetServerEnum(cli, unix_workgroup, 00123 local_type|SV_TYPE_DOMAIN_ENUM, 00124 callback, NULL); 00125 00126 /* Now fetch a server list. */ 00127 if (servers) { 00128 fstrcpy(unix_workgroup, workgroup); 00129 cli_NetServerEnum(cli, unix_workgroup, 00130 local?SV_TYPE_LOCAL_LIST_ONLY:SV_TYPE_ALL, 00131 callback, NULL); 00132 } 00133 00134 cli_shutdown(cli); 00135 }
void sync_browse_lists | ( | struct work_record * | work, | |
char * | name, | |||
int | nm_type, | |||
struct in_addr | ip, | |||
BOOL | local, | |||
BOOL | servers | |||
) |
nmbd_synclists.c の 143 行で定義されています。
参照先 all_string_sub()・BlockSignals()・CatchChild()・counter・sync_record::fname・fp・sync_record::ip・ismyip()・sync_record::pid・sync_record::server・sync_child()・syncs・sys_fork()・work_record::work_group・sync_record::workgroup・x_fclose()・x_fopen().
参照元 sync_all_dmbs()・sync_with_dmb()・sync_with_lmb().
00146 { 00147 struct sync_record *s; 00148 static int counter; 00149 00150 START_PROFILE(sync_browse_lists); 00151 /* Check we're not trying to sync with ourselves. This can 00152 happen if we are a domain *and* a local master browser. */ 00153 if (ismyip(ip)) { 00154 done: 00155 END_PROFILE(sync_browse_lists); 00156 return; 00157 } 00158 00159 s = SMB_MALLOC_P(struct sync_record); 00160 if (!s) goto done; 00161 00162 ZERO_STRUCTP(s); 00163 00164 unstrcpy(s->workgroup, work->work_group); 00165 unstrcpy(s->server, name); 00166 s->ip = ip; 00167 00168 slprintf(s->fname, sizeof(pstring)-1, 00169 "%s/sync.%d", lp_lockdir(), counter++); 00170 all_string_sub(s->fname,"//", "/", 0); 00171 00172 DLIST_ADD(syncs, s); 00173 00174 /* the parent forks and returns, leaving the child to do the 00175 actual sync and call END_PROFILE*/ 00176 CatchChild(); 00177 if ((s->pid = sys_fork())) return; 00178 00179 BlockSignals( False, SIGTERM ); 00180 00181 DEBUG(2,("Initiating browse sync for %s to %s(%s)\n", 00182 work->work_group, name, inet_ntoa(ip))); 00183 00184 fp = x_fopen(s->fname,O_WRONLY|O_CREAT|O_TRUNC, 0644); 00185 if (!fp) { 00186 END_PROFILE(sync_browse_lists); 00187 _exit(1); 00188 } 00189 00190 sync_child(name, nm_type, work->work_group, ip, local, servers, 00191 s->fname); 00192 00193 x_fclose(fp); 00194 END_PROFILE(sync_browse_lists); 00195 _exit(0); 00196 }
static void complete_one | ( | struct sync_record * | s, | |
char * | sname, | |||
uint32 | stype, | |||
char * | comment | |||
) | [static] |
nmbd_synclists.c の 202 行で定義されています。
参照先 create_server_on_workgroup()・create_workgroup_on_subnet()・find_server_in_workgroup()・find_workgroup_on_subnet()・work_record::local_master_browser_name・server_record::serv・server_info_struct::type・unicast_subnet・update_server_ttl()・update_workgroup_ttl()・sync_record::workgroup.
参照元 complete_sync().
00204 { 00205 struct work_record *work; 00206 struct server_record *servrec; 00207 00208 stype &= ~SV_TYPE_LOCAL_LIST_ONLY; 00209 00210 if (stype & SV_TYPE_DOMAIN_ENUM) { 00211 /* See if we can find the workgroup on this subnet. */ 00212 if((work=find_workgroup_on_subnet(unicast_subnet, sname))) { 00213 /* We already know about this workgroup - 00214 update the ttl. */ 00215 update_workgroup_ttl(work,lp_max_ttl()); 00216 } else { 00217 /* Create the workgroup on the subnet. */ 00218 work = create_workgroup_on_subnet(unicast_subnet, 00219 sname, lp_max_ttl()); 00220 if (work) { 00221 /* remember who the master is */ 00222 unstrcpy(work->local_master_browser_name, comment); 00223 } 00224 } 00225 return; 00226 } 00227 00228 work = find_workgroup_on_subnet(unicast_subnet, s->workgroup); 00229 if (!work) { 00230 DEBUG(3,("workgroup %s doesn't exist on unicast subnet?\n", 00231 s->workgroup)); 00232 return; 00233 } 00234 00235 if ((servrec = find_server_in_workgroup( work, sname))) { 00236 /* Check that this is not a locally known 00237 server - if so ignore the entry. */ 00238 if(!(servrec->serv.type & SV_TYPE_LOCAL_LIST_ONLY)) { 00239 /* We already know about this server - update 00240 the ttl. */ 00241 update_server_ttl(servrec, lp_max_ttl()); 00242 /* Update the type. */ 00243 servrec->serv.type = stype; 00244 } 00245 return; 00246 } 00247 00248 /* Create the server in the workgroup. */ 00249 create_server_on_workgroup(work, sname,stype, lp_max_ttl(), comment); 00250 }
static void complete_sync | ( | struct sync_record * | s | ) | [static] |
nmbd_synclists.c の 256 行で定義されています。
参照先 complete_one()・fgets_slash()・sync_record::fname・sync_record::ip・line・next_token()・sync_record::server・server・type・sync_record::workgroup・x_fclose()・x_feof()・x_fopen().
00257 { 00258 XFILE *f; 00259 unstring server, type_str; 00260 unsigned type; 00261 pstring comment; 00262 pstring line; 00263 const char *ptr; 00264 int count=0; 00265 00266 f = x_fopen(s->fname,O_RDONLY, 0); 00267 00268 if (!f) 00269 return; 00270 00271 while (!x_feof(f)) { 00272 00273 if (!fgets_slash(line,sizeof(pstring),f)) 00274 continue; 00275 00276 ptr = line; 00277 00278 if (!next_token(&ptr,server,NULL,sizeof(server)) || 00279 !next_token(&ptr,type_str,NULL, sizeof(type_str)) || 00280 !next_token(&ptr,comment,NULL, sizeof(comment))) { 00281 continue; 00282 } 00283 00284 sscanf(type_str, "%X", &type); 00285 00286 complete_one(s, server, type, comment); 00287 00288 count++; 00289 } 00290 00291 x_fclose(f); 00292 00293 unlink(s->fname); 00294 00295 DEBUG(2,("sync with %s(%s) for workgroup %s completed (%d records)\n", 00296 s->server, inet_ntoa(s->ip), s->workgroup, count)); 00297 }
void sync_check_completion | ( | void | ) |
nmbd_synclists.c の 303 行で定義されています。
参照先 complete_sync()・sync_record::next・sync_record::pid・process_exists_by_pid()・syncs.
参照元 process().
00304 { 00305 struct sync_record *s, *next; 00306 00307 for (s=syncs;s;s=next) { 00308 next = s->next; 00309 if (!process_exists_by_pid(s->pid)) { 00310 /* it has completed - grab the info */ 00311 complete_sync(s); 00312 DLIST_REMOVE(syncs, s); 00313 ZERO_STRUCTP(s); 00314 SAFE_FREE(s); 00315 } 00316 } 00317 }
substitute.c の 27 行で定義されています。
参照元 get_local_machine_name()・init_names()・set_local_machine_name()・sync_child().
struct sync_record* syncs [static] |
nmbd_synclists.c の 46 行で定義されています。
参照元 callback()・disk_quotas()・dump_all_namelists()・dump_name_record()・dump_subnet_namelist()・dump_wins_subnet_namelist()・endlmhosts()・getlmhostsent()・initialise_wins()・load_lmhosts_file()・main()・procname()・resolve_lmhosts()・startlmhosts()・startsmbfilepwent()・sync_browse_lists()・sys_path_to_bdev()・traverse_fn()・trim_char()・wins_write_database()・wins_write_name_record()・wins_writedb_traverse_fn()・write_browse_list()・write_browse_list_entry()・writetarheader().