NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) { if (!ctx) { return NET_API_STATUS_SUCCESS; } libnetapi_samr_free(ctx); libnetapi_shutdown_cm(ctx); if (ctx->krb5_cc_env) { char *env = getenv(KRB5_ENV_CCNAME); if (env && (strequal(ctx->krb5_cc_env, env))) { unsetenv(KRB5_ENV_CCNAME); } } gfree_names(); gfree_loadparm(); gfree_case_tables(); gfree_charcnv(); gfree_interfaces(); gencache_shutdown(); secrets_shutdown(); TALLOC_FREE(ctx); TALLOC_FREE(frame); gfree_debugsyms(); return NET_API_STATUS_SUCCESS; }
void load_interfaces(void) { struct iface_struct *ifaces = NULL; const char **ptr = lp_interfaces(); int i; gfree_interfaces(); /* Probe the kernel for interfaces */ total_probed = get_interfaces(talloc_tos(), &ifaces); if (total_probed > 0) { probed_ifaces = (struct iface_struct *)smb_memdup(ifaces, sizeof(ifaces[0])*total_probed); if (!probed_ifaces) { DEBUG(0,("ERROR: smb_memdup failed\n")); exit(1); } } TALLOC_FREE(ifaces); /* if we don't have a interfaces line then use all broadcast capable interfaces except loopback */ if (!ptr || !*ptr || !**ptr) { if (total_probed <= 0) { DEBUG(0,("ERROR: Could not determine network " "interfaces, you must use a interfaces config line\n")); exit(1); } for (i=0;i<total_probed;i++) { if (probed_ifaces[i].flags & IFF_BROADCAST) { add_interface(&probed_ifaces[i]); } } return; } if (ptr) { while (*ptr) { char *ptr_cpy = SMB_STRDUP(*ptr); if (ptr_cpy) { interpret_interface(ptr_cpy); free(ptr_cpy); } ptr++; } } if (!local_interfaces) { DEBUG(0,("WARNING: no network interfaces found\n")); } }
NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) { TALLOC_CTX *frame; if (!ctx) { return NET_API_STATUS_SUCCESS; } frame = talloc_stackframe(); libnetapi_samr_free(ctx); libnetapi_shutdown_cm(ctx); if (ctx->krb5_cc_env) { char *env = getenv(KRB5_ENV_CCNAME); if (env && (strequal(ctx->krb5_cc_env, env))) { unsetenv(KRB5_ENV_CCNAME); } } gfree_names(); gfree_loadparm(); gfree_charcnv(); gfree_interfaces(); secrets_shutdown(); if (ctx == stat_ctx) { stat_ctx = NULL; } TALLOC_FREE(ctx); gfree_debugsyms(); talloc_free(frame); return NET_API_STATUS_SUCCESS; }