From 7c34811440be0bf1e749d9f075f54320c706cb4b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 16 Feb 2019 18:36:21 +0100 Subject: [PATCH] Cygwin: passwd/group: allow specifying "." as local computername Convenience only. The resulting passwd/group antry is still fully qualified. Signed-off-by: Corinna Vinschen --- winsup/cygwin/uinfo.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 53efc2117..47fe24725 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -2008,7 +2008,15 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap) if ((p = wcschr (name, cygheap->pg.nss_separator ()[0]))) { fq_name = true; - *p = L'\\'; + /* Convenience: Translate domain name "." to local machine. */ + if (p == name + 1 && name[0] == L'.') + { + p = wcpcpy (name, cygheap->dom.account_flat_name ()); + *p = L'\\'; + sys_mbstowcs (p + 1, UNLEN + 1, arg.name + 2); + } + else + *p = L'\\'; } sid = csid; ret = LookupAccountNameW (NULL, name, sid, &slen, dom, &dlen, &acc_type);