static void setup_new_vc_session(void) { DEBUG(2,("setup_new_vc_session: New VC == 0, if NT4.x compatible we would close all old resources.\n")); #if 0 conn_close_all(); invalidate_all_vuids(); #endif }
static void setup_new_vc_session(void) { DEBUG(2,("setup_new_vc_session: New VC == 0, if NT4.x compatible we would close all old resources.\n")); #if 0 conn_close_all(); invalidate_all_vuids(); #endif if (lp_reset_on_zero_vc()) { session_traverse(shutdown_other_smbds, client_addr()); } }
/**************************************************************************** receive a smbcontrol message to forcibly unmount a share the message contains just a share name and all instances of that share are unmounted the special sharename '*' forces unmount of all shares ****************************************************************************/ void msg_force_tdis(int msg_type, pid_t pid, void *buf, size_t len) { connection_struct *conn, *next; fstring sharename; fstrcpy(sharename, buf); if (strcmp(sharename, "*") == 0) { DEBUG(1,("Forcing close of all shares\n")); conn_close_all(); return; } for (conn=Connections;conn;conn=next) { next=conn->next; if (strequal(lp_servicename(conn->service), sharename)) { DEBUG(1,("Forcing close of share %s cnum=%d\n", sharename, conn->cnum)); close_cnum(conn, (uint16)-1); } } }
static int ac_packetfilter_stats(ac_sip_t *asip, void *data) { osip_message_t* sip = asip->evt->sip; char *callid = 0; unsigned long now = ship_systemtimemillis(); if (asip->remotely_got) { /* .. meaning remotely got */ if (MSG_IS_RESPONSE(sip)) { pdd_stat_t *stat = 0; int code = osip_message_get_status_code(sip); /* check for ACK with code != 100 */ callid = sipp_get_call_id(sip); ship_lock(stats) ; if (code != 100 && (stat = ship_ht_get_string(stats, callid)) && !stat->end) { stat->end = ship_systemtimemillis(); LOG_INFO("Got PDD for %s %s -> %s (status %d) in %u.%03u seconds..\n", stat->msg_type, stat->from, stat->to, code, (stat->end - stat->start) / 1000, ((stat->end - stat->start) % 1000)); /* ... if we are recording special, then do that! */ if (pdd_log) { pdd_record_pdd(stat); } /* remove.. ? */ ship_ht_remove_string(stats, callid); ship_lock(done_stats); while (ship_list_length(done_stats) > 20) { pdd_stat_t *s2 = ship_list_pop(done_stats); ship_ht_remove(done_stats_ht, s2); pdd_free_stat(s2); } ship_list_add(done_stats, stat); ship_ht_put_string(done_stats_ht, callid, stat); ship_unlock(done_stats); } ship_unlock(stats); } else if (MSG_IS_INVITE(sip) || MSG_IS_MESSAGE(sip)) { /* record the pdd for the other fellow .. */ callid = sipp_get_call_id(sip); /* send 'stats' packet back, event remote_req */ ac_send_stats(asip->remote, asip->local, now, callid, "remote_start"); } } else { /* if we get an invite or something like that, record the time .. and so on */ if (MSG_IS_INVITE(sip) || MSG_IS_MESSAGE(sip)) { /* if not seen already & pdd mode, do some funky stuff.. */ if (pdd_reset_mode) { LOG_INFO("pdd measurement mode: clearing SAs and peer DB!\n"); #ifdef CONFIG_HIP_ENABLED hipapi_clear_sas(); #endif ident_reset_foreign_regs(); conn_close_all(); } callid = sipp_get_call_id(sip); ship_lock(stats); if (!ship_ht_get_string(stats, callid)) { pdd_stat_t *stat = pdd_new_stat(sip, asip->from, asip->to); if (stat) { stat->start = ship_systemtimemillis(); ship_ht_put_string(stats, callid, stat); } } ship_unlock(stats); } else if (MSG_IS_RESPONSE(sip)) { int code = osip_message_get_status_code(sip); if (code != 100) { callid = sipp_get_call_id(sip); /* send 'stats' packet back, event remote_resp */ ac_send_stats(asip->remote, asip->local, now, callid, "remote_end"); } } } freez(callid); return 1; }
static void exit_server_common(enum server_exit_reason how, const char *const reason) { struct smbd_server_connection *sconn = smbd_server_conn; if (!exit_firsttime) exit(0); exit_firsttime = false; change_to_root_user(); if (sconn && sconn->smb1.negprot.auth_context) { TALLOC_FREE(sconn->smb1.negprot.auth_context); } if (sconn) { if (lp_log_writeable_files_on_exit()) { bool found = false; files_forall(sconn, log_writeable_file_fn, &found); } (void)conn_close_all(sconn); invalidate_all_vuids(sconn); } /* 3 second timeout. */ print_notify_send_messages(sconn->msg_ctx, 3); /* delete our entry in the serverid database. */ if (am_parent) { /* * For children the parent takes care of cleaning up */ serverid_deregister(sconn_server_id(sconn)); } #ifdef WITH_DFS if (dcelogin_atmost_once) { dfs_unlogin(); } #endif #ifdef USE_DMAPI /* Destroy Samba DMAPI session only if we are master smbd process */ if (am_parent) { if (!dmapi_destroy_session()) { DEBUG(0,("Unable to close Samba DMAPI session\n")); } } #endif if (am_parent) { rpc_wkssvc_shutdown(); #ifdef ACTIVE_DIRECTORY rpc_dssetup_shutdown(); #endif #ifdef DEVELOPER rpc_rpcecho_shutdown(); #endif #ifdef DFS_SUPPORT rpc_netdfs_shutdown(); #endif rpc_initshutdown_shutdown(); #ifdef EXTRA_SERVICES rpc_eventlog_shutdown(); rpc_svcctl_shutdown(); rpc_ntsvcs_shutdown(); #endif #ifdef PRINTER_SUPPORT rpc_spoolss_shutdown(); #endif rpc_srvsvc_shutdown(); #ifdef WINREG_SUPPORT rpc_winreg_shutdown(); #endif #ifdef NETLOGON_SUPPORT rpc_netlogon_shutdown(); #endif #ifdef SAMR_SUPPORT rpc_samr_shutdown(); #endif #ifdef LSA_SUPPORT rpc_lsarpc_shutdown(); #endif } /* * we need to force the order of freeing the following, * because smbd_msg_ctx is not a talloc child of smbd_server_conn. */ sconn = NULL; TALLOC_FREE(smbd_server_conn); server_messaging_context_free(); server_event_context_free(); TALLOC_FREE(smbd_memcache_ctx); locking_end(); printing_end(); if (how != SERVER_EXIT_NORMAL) { DEBUGSEP(0); DEBUG(0,("Abnormal server exit: %s\n", reason ? reason : "no explanation provided")); DEBUGSEP(0); log_stack_trace(); dump_core(); /* Notreached. */ exit(1); } else { DEBUG(3,("Server exit (%s)\n", (reason ? reason : "normal exit"))); if (am_parent) { pidfile_unlink(); } gencache_stabilize(); } exit(0); }
static void exit_server_common(enum server_exit_reason how, const char *const reason) { static int firsttime=1; if (!firsttime) { #ifndef _XBOX exit(0); #endif } firsttime = 0; change_to_root_user(); if (negprot_global_auth_context) { (negprot_global_auth_context->free)(&negprot_global_auth_context); } conn_close_all(); invalidate_all_vuids(); #ifndef _XBOX print_notify_send_messages(3); /* 3 second timeout. */ #endif /* delete our entry in the connections database. */ yield_connection(NULL,""); respond_to_all_remaining_local_messages(); decrement_smbd_process_count(); #ifdef WITH_DFS if (dcelogin_atmost_once) { dfs_unlogin(); } #endif #ifndef _XBOX locking_end(); printing_end(); #endif if (how != SERVER_EXIT_NORMAL) { int oldlevel = DEBUGLEVEL; char *last_inbuf = get_InBuffer(); DEBUGLEVEL = 10; DEBUGSEP(0); DEBUG(0,("Abnormal server exit: %s\n", reason ? reason : "no explanation provided")); DEBUGSEP(0); #ifndef _XBOX log_stack_trace(); #endif if (last_inbuf) { DEBUG(0,("Last message was %s\n", LAST_MESSAGE())); show_msg(last_inbuf); } DEBUGLEVEL = oldlevel; #if DUMP_CORE dump_core(); #endif } else { DEBUG(3,("Server exit (%s)\n", (reason ? reason : "normal exit"))); } #ifndef _XBOX exit(0); #endif }
//os void smbd_process(int ProcSockID, void *nouse1, void *nouse2) void smbd_process (cyg_addrword_t data) { int ProcSockID = data; //0704 extern int smb_echo_count; //0705 time_t last_timeout_processing_time = time(NULL); /* 0416 from global variable */ //char __inbuf[SMB_BUFFER_SIZE + SAFETY_MARGIN]; //0621char __oubuf[SMB_BUFFER_SIZE + SAFETY_MARGIN]; //Jesse char __inbuf[SMB_BUFFER_SIZE]; //Jesse char __oubuf[MAX_SEND_SIZE]; char __inbuf[SMB_BUFFER_SIZE + 16]; char __oubuf[MAX_SEND_SIZE + 16]; char *InBuffer = __inbuf; char *OutBuffer = __oubuf; int i, threadid=0; int testInbufsize=0, testOutbufsize=0; testInbufsize = sizeof(__inbuf); testOutbufsize = sizeof(__oubuf); // InBuffer += SMB_ALIGNMENT; // ??? why ??? 7/18/2001 by ron // OutBuffer += SMB_ALIGNMENT; /* re-initialise the timezone */ //0302 TimeInit(); for (i =0; i < NUM_SMBTHREAD; i++){ if (smbthread[i] == ProcSockID){ threadid =i; break; } } if (threadid >= NUM_SMBTHREAD) threadid = -1; thread_isused[threadid]++; //for debug while (True) { // int change_notify_timeout = 1 * 1000; int got_smb = False; //0705 int select_timeout = SMBD_SELECT_TIMEOUT*1000;//setup_select_timeout(); check_idle_conn(RELEASE_RESOURCE_TIMEOUT, threadid); // check Idle Connection ....Ron Add 3/8/2002 while(!receive_message_or_smb(InBuffer,SMB_BUFFER_SIZE, &got_smb ,ProcSockID ,threadid) || _forceclosethread[threadid] ==1) { if(!timeout_processing(SET_SMBD_TIMEOUT, threadid)){ conn_close_all(threadid); pipe_close_all(threadid); //7/19/2001 by ron reset_global_variables(threadid); //Jesse close_s(ProcSockID); //close socket 6/29/2001 by ron close(ProcSockID); //close socket cyg_thread_exit(); return; } //0418 num_smbs = 0; /* Reset smb counter. */ //os kwait(NULL); cyg_thread_yield(); } //while if (threadid < 0 ||ProcSockID < 0) { cyg_thread_exit(); return; } if(got_smb) { /* * Ensure we do timeout processing if the SMB we just got was * only an echo request. This allows us to set the select * timeout in 'receive_message_or_smb()' to any value we like * without worrying that the client will send echo requests * faster than the select timeout, thus starving out the * essential processing (change notify, blocking locks) that * the timeout code does. JRA. */ //0704 int num_echos = smb_echo_count; process_smb(InBuffer, OutBuffer, ProcSockID, threadid); } //if //os kwait(NULL); cyg_thread_yield(); } //while }