- diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
- index ffce9be..a608467 100644
- --- a/cygwin/devel/msnfs41client.bash
- +++ b/cygwin/devel/msnfs41client.bash
- @@ -143,7 +143,13 @@ function nfsclient_install
- bcdedit /dbgsettings local
- # set domain name
- + typeset win_domainname=''
- + if [[ -f '/proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters/Domain' ]] ; then
- + win_domainname="$( strings '/proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters/Domain' )"
- + fi
- + if [[ "${win_domainname}" == '' ]] ; then
- regtool -s set '/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters/Domain' 'GLOBAL.LOC'
- + fi
- # disable DFS
- sc query Dfsc
- @@ -204,10 +210,11 @@ function nfsclient_rundeamon
- {
- set -o nounset
- - printf '# user='%s' uname='%s' isadmin=%d\n' \
- + printf '# user="%s" uname="%s" isadmin=%d domainname="%s"\n' \
- "$(id -u -n)" \
- "$(uname -a)" \
- - "$(is_windows_admin_account ; printf "%d\n" $((${?}?0:1)))"
- + "$(is_windows_admin_account ; printf "%d\n" $((${?}?0:1)))" \
- + "$(domainname)"
- # sync before starting nfs41 client daemon, to limit the damage
- # if the kernel module generates a crash on startup
- @@ -301,10 +308,11 @@ function nfsclient_system_rundeamon
- {
- set -o nounset
- - printf '# user='%s' uname='%s' isadmin=%d\n' \
- + printf '# user="%s" uname="%s" isadmin=%d domainname="%s"\n' \
- "$(id -u -n)" \
- "$(uname -a)" \
- - "$(is_windows_admin_account ; printf "%d\n" $((${?}?0:1)))"
- + "$(is_windows_admin_account ; printf "%d\n" $((${?}?0:1)))" \
- + "$(domainname)"
- # sync before starting nfs41 client daemon, to limit the damage
- # if the kernel module generates a crash on startup
- diff --git a/daemon/idmap.c b/daemon/idmap.c
- index 8fe4fd4..c09460c 100644
- --- a/daemon/idmap.c
- +++ b/daemon/idmap.c
- @@ -84,6 +84,7 @@ static const char CONFIG_FILENAME[] = "C:\\etc\\ms-nfs41-idmap.conf";
- struct idmap_config {
- /* ldap server information */
- char hostname[NFS41_HOSTNAME_LEN+1];
- + char localdomain_name[NFS41_HOSTNAME_LEN+1];
- UINT port;
- UINT version;
- UINT timeout;
- @@ -728,7 +729,8 @@ static int idmap_lookup_user(
- ("# ATTR_USER_NAME: cygwin_getent_passwd: returned '%s', uid=%u, gid=%u\n",
- lookup->value, (unsigned int)cy_uid, (unsigned int)cy_gid));
- (void)snprintf(principal_name, sizeof(principal_name),
- - "%s@%s", (const char *)lookup->value, "GLOBAL.LOC");
- + "%s@%s", (const char *)lookup->value,
- + context->config.localdomain_name);
- StringCchCopyA(user->username, VAL_LEN, lookup->value);
- StringCchCopyA(user->principal, VAL_LEN, principal_name);
- user->uid = cy_uid;
- @@ -758,7 +760,8 @@ static int idmap_lookup_user(
- ("# ATTR_PRINCIPAL: cygwin_getent_passwd: returned '%s', uid=%u, gid=%u\n",
- lookup->value, (unsigned int)cy_uid, (unsigned int)cy_gid));
- (void)snprintf(principal_name, sizeof(principal_name),
- - "%s@%s", (const char *)lookup->value, "GLOBAL.LOC");
- + "%s@%s", (const char *)lookup->value,
- + context->config.localdomain_name);
- if (!strcmp(principal_name, lookup->value)) {
- StringCchCopyA(user->username, VAL_LEN, search_name);
- @@ -785,7 +788,8 @@ static int idmap_lookup_user(
- DPRINTF(CYGWINIDLVL,
- ("# ATTR_UID: cygwin_getent_passwd: returned '%s', uid=%u, gid=%u\n",
- res_username, (unsigned int)cy_uid, (unsigned int)cy_gid));
- - (void)snprintf(principal_name, sizeof(principal_name), "%s@%s", res_username, "GLOBAL.LOC");
- + (void)snprintf(principal_name, sizeof(principal_name),
- + "%s@%s", res_username, context->config.localdomain_name);
- StringCchCopyA(user->username, VAL_LEN, res_username);
- StringCchCopyA(user->principal, VAL_LEN, principal_name);
- @@ -929,7 +933,7 @@ out:
- /* public idmap interface */
- int nfs41_idmap_create(
- - struct idmap_context **context_out)
- + struct idmap_context **context_out, const char *localdomain_name)
- {
- struct idmap_context *context;
- int status = NO_ERROR;
- @@ -940,6 +944,14 @@ int nfs41_idmap_create(
- goto out;
- }
- + (void)strcpy_s(context->config.localdomain_name,
- + sizeof(context->config.localdomain_name),
- + localdomain_name);
- + if (context == NULL) {
- + status = GetLastError();
- + goto out;
- + }
- +
- /* initialize the caches */
- cache_init(&context->users, &user_cache_ops);
- cache_init(&context->groups, &group_cache_ops);
- diff --git a/daemon/idmap.h b/daemon/idmap.h
- index 82b5867..6a74458 100644
- --- a/daemon/idmap.h
- +++ b/daemon/idmap.h
- @@ -30,7 +30,7 @@
- typedef struct idmap_context nfs41_idmapper;
- int nfs41_idmap_create(
- - nfs41_idmapper **context_out);
- + nfs41_idmapper **context_out, const char *localdomain_name);
- void nfs41_idmap_free(
- nfs41_idmapper *context);
- diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
- index febca0d..4797b00 100644
- --- a/daemon/nfs41_daemon.c
- +++ b/daemon/nfs41_daemon.c
- @@ -762,7 +762,10 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
- nfs41_server_list_init();
- if (cmd_args.ldap_enable) {
- - status = nfs41_idmap_create(&(nfs41_dg.idmapper));
- + EASSERT(nfs41_dg.localdomain_name[0] != '\0');
- +
- + status = nfs41_idmap_create(&(nfs41_dg.idmapper),
- + nfs41_dg.localdomain_name);
- if (status) {
- eprintf("id mapping initialization failed with %d\n", status);
- goto out_logs;
- diff --git a/libtirpc/src/clnt_vc.c b/libtirpc/src/clnt_vc.c
- index f15eb38..bc03ab3 100644
- --- a/libtirpc/src/clnt_vc.c
- +++ b/libtirpc/src/clnt_vc.c
- @@ -175,6 +175,7 @@ static cond_t *vc_cv;
- /* XXX Need Windows signal/event stuff XXX */
- #define release_fd_lock(fd, mask) { \
- mutex_lock(&clnt_fd_lock); \
- + assert(vc_fd_locks[(fd)] != 0); \
- vc_fd_locks[(fd)] = 0; \
- \
- cond_broadcast(&vc_cv[(fd)]); \
- @@ -195,6 +196,16 @@ static const char clnt_vc_str[] = "clnt_vc_create";
- static const char clnt_read_vc_str[] = "read_vc";
- static const char __no_mem_str[] = "out of memory";
- +#if 1
- +#define TIRPCDbgEnter() __try {
- +
- +#define TIRPCDbgLeave() } \
- + __except(EXCEPTION_EXECUTE_HANDLER) { \
- + (void)fprintf(stderr, \
- + "#### FATAL: exception in '%s'/%ld ####\n", \
- + __FILE__, (long)__LINE__); }
- +#endif
- +
- /* callback thread */
- #define CALLBACK_TIMEOUT 5000
- #define RQCRED_SIZE 400 /* this size is excessive */
- @@ -211,20 +222,45 @@ static unsigned int WINAPI clnt_cb_thread(void *args)
- (void)fprintf(stderr/*stdout*/,
- "%04lx: cb: Callback thread running\n", (long)GetCurrentThreadId());
- +
- +#if 1
- + int cond_wait_timed_fails;
- + DWORD lasterr;
- +
- +loop_restart:
- +#endif
- while(1) {
- cb_req header;
- void *res = NULL;
- +
- +#if 1
- + TIRPCDbgEnter();
- +#endif
- mutex_lock(&clnt_fd_lock);
- +#if 1
- + cond_wait_timed_fails = 0;
- +#endif
- while (vc_fd_locks[ct->ct_fd] ||
- !ct->use_stored_reply_msg ||
- (ct->use_stored_reply_msg && ct->reply_msg.rm_direction != CALL)) {
- if (cl->shutdown)
- break;
- if (!cond_wait_timed(&vc_cv[ct->ct_fd], &clnt_fd_lock,
- - CALLBACK_TIMEOUT))
- + CALLBACK_TIMEOUT)) {
- +#if 1
- + lasterr = GetLastError();
- + if (cond_wait_timed_fails++ > 2) {
- + mutex_unlock(&clnt_fd_lock);
- + (void)fprintf(stdout,
- + "%04lx: cb: possible deadlockm, lasterr=%d\n",
- + (long)GetCurrentThreadId(), (int)lasterr);
- + goto loop_restart;
- + }
- +#endif
- if (!vc_fd_locks[ct->ct_fd])
- break;
- }
- + }
- vc_fd_locks[ct->ct_fd] = 1;
- mutex_unlock(&clnt_fd_lock);
- @@ -316,6 +352,9 @@ skip_setlastfrag:
- ct->ct_wait.tv_sec = saved_timeout_sec;
- ct->ct_wait.tv_usec = saved_timeout_usec;
- release_fd_lock(ct->ct_fd, mask);
- +#if 1
- + TIRPCDbgLeave();
- +#endif
- }
- out:
- return status;
backup 20240610
Posted by Anonymous on Mon 10th Jun 2024 16:54
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.