pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post c8dfa790 by Anonymous on Tue 19th Sep 2023 13:52
original post 7923b0b by Anonymous on Sat 16th Sep 2023 13:43
Download diff
Show old version | new version | both versions

    
1-
diff --git a/daemon/idmap.c b/daemon/idmap.c
1+
diff --git a/daemon/acl.c b/daemon/acl.c
2-
index 0dfa8ef..b50f4e2 100644
2+
index 3a86735..61a737d 100644
3-
--- a/daemon/idmap.c
3+
--- a/daemon/acl.c
4-
+++ b/daemon/idmap.c
4+
+++ b/daemon/acl.c
5-
@@ -31,6 +31,7 @@
5+
@@ -65,6 +65,9 @@ static int create_unknownsid(WELL_KNOWN_SID_TYPE type, PSID *sid,
6-
 #include "list.h"
6+
     status = GetLastError();
7-
 #include "daemon_debug.h"
7+
     if (status != ERROR_INSUFFICIENT_BUFFER)
148
     return status;
15-
 }
9+
+#if 1
10+
+*sid_len += 256;
1618
17-
+#ifdef CYGWIN_GETENT_USERDATA
19+
+#if 1
18-
+int cygwin_getent_passwd(const char *name, char *res_loginname, uid_t *res_uid, gid_t *res_gid)
20+
+    /* test mapping: Map UNIX user "rmainz" to Windows user "roland_mainz" */
19-
+{
21+
+    if (!_stricmp(name, "rmainz"))
20-
+    char cmdbuff[1024];
22+
+    	name = "roland_mainz";
21-
+    char passwd_line[1024];
23+
+#endif
22-
+    FILE* getent_pipe;
24+
     status = LookupAccountName(NULL, name, NULL, sid_len, NULL, &tmp, &sid_type);
23-
+    int res = 1;
25+
     dprintf(ACLLVL, "map_name_2_sid: LookupAccountName for %s returned %d "
24-
+
26+
             "GetLastError %d name len %d domain len %d\n", name, status,
25-
+    /* fixme: better quoting for |name| needed */
27+
@@ -107,6 +115,9 @@ static int map_name_2_sid(DWORD *sid_len, PSID *sid, LPCSTR name)
26-
+    (void)snprintf(cmdbuff, sizeof(cmdbuff), "%s passwd \"%s\"",
28+
     status = GetLastError();
27-
+        "C:\\cygwin64\\bin\\getent.exe",
29+
     switch(status) {
28-
+        name);
30+
     case ERROR_INSUFFICIENT_BUFFER:
29-
+    if ((getent_pipe = _popen(cmdbuff, "rt")) == NULL)
31+
+#if 1
30-
+    {
32+
+*sid_len += 256;
31-
+        (void)perror("getent failed");
33+
+#endif
32-
+        return 1;
34+
         *sid = malloc(*sid_len);
33-
+    }
35+
         if (*sid == NULL) {
34-
+
36+
             status = GetLastError();
35-
+    if (fgets(passwd_line, sizeof(passwd_line), getent_pipe))
37+
@@ -798,4 +809,4 @@ const nfs41_upcall_op nfs41_op_setacl = {
36-
+    {
38+
     parse_setacl,
37-
+        struct _cypwent
39+
     handle_setacl,
38-
+        {
40+
     marshall_setacl
39-
+            char* loginname;
41+
-};
40-
+            char* passwd;
42+
\ No newline at end of file
41-
+            char* uidstr;
43+
+};
42-
+            char* gidstr;
44+
diff --git a/daemon/idmap.c b/daemon/idmap.c
43-
+            char* comment;
45+
index 0dfa8ef..b50f4e2 100644
44-
+            char* homedir;
46+
--- a/daemon/idmap.c
45-
+            char* shell;
47+
+++ b/daemon/idmap.c
46-
+        } pwent = { 0 };
48+
@@ -31,6 +31,7 @@
47-
+#define PWENT_ENTRY(var, prevvar) \
49+
 #include "list.h"
48-
+            (((var) = strchr((prevvar), ':'))?(*(var)++ = '\0',(var)):(NULL))
50+
 #include "daemon_debug.h"
49-
+
51+
50-
+        pwent.loginname = passwd_line;
52+
+#define CYGWIN_GETENT_USERDATA 1
51-
+        if (!PWENT_ENTRY(pwent.passwd, pwent.loginname)) goto fail;
53+
52-
+        if (!PWENT_ENTRY(pwent.uidstr, pwent.passwd)) goto fail;
54+
 #define IDLVL 2 /* dprintf level for idmap logging */
53-
+        if (!PWENT_ENTRY(pwent.gidstr, pwent.uidstr)) goto fail;
55+
54-
+        if (!PWENT_ENTRY(pwent.comment, pwent.gidstr)) goto fail;
56+
@@ -375,6 +376,156 @@ out:
55-
+        if (!PWENT_ENTRY(pwent.homedir, pwent.comment)) goto fail;
57+
     return status;
56-
+        PWENT_ENTRY(pwent.shell, pwent.homedir);
58+
 }
59+
5767
+
58-
+        unsigned long uid;
68+
+    /* fixme: better quoting for |name| needed */
59-
+        unsigned long gid;
69+
+    (void)snprintf(cmdbuff, sizeof(cmdbuff), "%s passwd \"%s\"",
70+
+        "C:\\cygwin64\\bin\\getent.exe",
6077
+
61-
+        errno = 0;
78+
+    if (fgets(passwd_line, sizeof(passwd_line), getent_pipe))
62-
+        uid = strtol(pwent.uidstr, NULL, 10);
79+
+    {
63-
+        if (errno != 0)
80+
+        struct _cypwent
64-
+            goto fail;
81+
+        {
65-
+
82+
+            char* loginname;
66-
+        errno = 0;
83+
+            char* passwd;
67-
+        gid = strtol(pwent.gidstr, NULL, 10);
84+
+            char* uidstr;
68-
+        if (errno != 0)
85+
+            char* gidstr;
69-
+            goto fail;
86+
+            char* comment;
87+
+            char* homedir;
7092
+
71-
+#if 1
93+
+        pwent.loginname = passwd_line;
72-
+	/* hack for testing, map "roland_mainz" to rmainz account */
94+
+        if (!PWENT_ENTRY(pwent.passwd, pwent.loginname)) goto fail;
73-
+	if (!_stricmp(pwent.loginname, "roland_mainz")) {
95+
+        if (!PWENT_ENTRY(pwent.uidstr, pwent.passwd)) goto fail;
74-
+		uid = 1616;
96+
+        if (!PWENT_ENTRY(pwent.gidstr, pwent.uidstr)) goto fail;
75-
+		gid = 1616;
97+
+        if (!PWENT_ENTRY(pwent.comment, pwent.gidstr)) goto fail;
76-
+	}
98+
+        if (!PWENT_ENTRY(pwent.homedir, pwent.comment)) goto fail;
77-
+#endif
99+
+        PWENT_ENTRY(pwent.shell, pwent.homedir);
78-
+#if 0
100+
+
79-
+        (void)printf("loginname\t=%s\n", pwent.loginname);
101+
+        unsigned long uid;
80-
+        (void)printf("passwd\t=%s\n", pwent.passwd);
102+
+        unsigned long gid;
81-
+        (void)printf("uidstr\t=%s (%lu)\n", pwent.uidstr, (unsigned long)uid);
103+
+
82-
+        (void)printf("gidstr\t=%s (%lu)\n", pwent.gidstr, (unsigned long)gid);
104+
+        errno = 0;
83-
+        (void)printf("comment\t=%s\n", pwent.comment);
105+
+        uid = strtol(pwent.uidstr, NULL, 10);
84-
+        (void)printf("homedir\t=%s\n", pwent.homedir);
106+
+        if (errno != 0)
85-
+        (void)printf("shell\t=%s\n", pwent.shell);
107+
+            goto fail;
93108
+
94-
+fail:
109+
+        errno = 0;
95-
+    (void)_pclose(getent_pipe);
110+
+        gid = strtol(pwent.gidstr, NULL, 10);
111+
+        if (errno != 0)
96113
+
97-
+    return res;
114+
+#if 1
98-
+}
115+
+	/* hack for testing, map "roland_mainz" to rmainz account */
99-
+
116+
+	if (!_stricmp(pwent.loginname, "roland_mainz")) {
100-
+int cygwin_getent_group(const char* name, char* res_group_name, gid_t* res_gid)
117+
+		uid = 1616;
101-
+{
118+
+		gid = 1616;
102-
+    char cmdbuff[1024];
119+
+	}
103-
+    char group_line[1024];
120+
+#endif
104-
+    FILE* getent_pipe;
121+
+#if 0
105-
+    int res = 1;
122+
+        (void)printf("loginname\t=%s\n", pwent.loginname);
106-
+
123+
+        (void)printf("passwd\t=%s\n", pwent.passwd);
107-
+    /* fixme: better quoting for |name| needed */
124+
+        (void)printf("uidstr\t=%s (%lu)\n", pwent.uidstr, (unsigned long)uid);
108-
+    (void)snprintf(cmdbuff, sizeof(cmdbuff), "%s group \"%s\"",
125+
+        (void)printf("gidstr\t=%s (%lu)\n", pwent.gidstr, (unsigned long)gid);
109-
+        "C:\\cygwin64\\bin\\getent.exe",
126+
+        (void)printf("comment\t=%s\n", pwent.comment);
110-
+        name);
127+
+        (void)printf("homedir\t=%s\n", pwent.homedir);
111-
+    if ((getent_pipe = _popen(cmdbuff, "rt")) == NULL)
128+
+        (void)printf("shell\t=%s\n", pwent.shell);
112-
+    {
129+
+#endif
113-
+        (void)perror("getent failed");
130+
+        if (res_loginname)
114-
+        return 1;
131+
+            (void)strcpy_s(res_loginname, VAL_LEN, pwent.loginname);
132+
+        *res_uid = uid;
115135
+    }
116136
+
117-
+    if (fgets(group_line, sizeof(group_line), getent_pipe))
137+
+fail:
118-
+    {
138+
+    (void)_pclose(getent_pipe);
126139
+
127-
+        grent.group_name = group_line;
140+
+    return res;
128-
+        if (!PWENT_ENTRY(grent.passwd, grent.group_name)) goto fail;
141+
+}
131142
+
132-
+        unsigned long gid;
143+
+int cygwin_getent_group(const char* name, char* res_group_name, gid_t* res_gid)
144+
+{
133149
+
134-
+        errno = 0;
150+
+    /* fixme: better quoting for |name| needed */
135-
+        gid = strtol(grent.gidstr, NULL, 10);
151+
+    (void)snprintf(cmdbuff, sizeof(cmdbuff), "%s group \"%s\"",
136-
+        if (errno != 0)
152+
+        "C:\\cygwin64\\bin\\getent.exe",
137-
+            goto fail;
153+
+        name);
154+
+    if ((getent_pipe = _popen(cmdbuff, "rt")) == NULL)
138159
+
139-
+#if 1
160+
+    if (fgets(group_line, sizeof(group_line), getent_pipe))
140-
+	/* hack for testing, map "roland_mainz" to rmainz account */
161+
+    {
141-
+	if (!_stricmp(grent.group_name, "roland_mainz")) {
162+
+        struct _cygrent
142-
+		gid = 1616;
163+
+        {
143-
+	}
164+
+            char* group_name;
144-
+#endif
165+
+            char* passwd;
166+
+            char* gidstr;
145169
+
146-
+        (void)printf("group_name\t=%s\n", grent.group_name);
170+
+        grent.group_name = group_line;
147-
+        (void)printf("passwd\t=%s\n", grent.passwd);
171+
+        if (!PWENT_ENTRY(grent.passwd, grent.group_name)) goto fail;
148-
+        (void)printf("gidstr\t=%s (%lu)\n", grent.gidstr, (unsigned long)gid);
172+
+        if (!PWENT_ENTRY(grent.gidstr, grent.passwd)) goto fail;
149-
+        (void)printf("userlist\t=%s\n", grent.userlist);
173+
+        PWENT_ENTRY(grent.userlist, grent.gidstr);
150174
+
151-
+        if (res_group_name)
175+
+        unsigned long gid;
160176
+
161-
+fail:
177+
+        errno = 0;
162-
+    (void)_pclose(getent_pipe);
178+
+        gid = strtol(grent.gidstr, NULL, 10);
179+
+        if (errno != 0)
163181
+
164-
+    return res;
182+
+#if 1
165-
+}
183+
+	/* hack for testing, map "roland_mainz" to rmainz account */
166-
+#endif /* CYGWIN_GETENT_USERDATA */
184+
+	if (!_stricmp(grent.group_name, "roland_mainz")) {
167-
185+
+		gid = 1616;
168-
 /* generic cache */
186+
+	}
169-
 typedef struct list_entry* (*entry_alloc_fn)();
187+
+#endif
170-
@@ -665,10 +816,10 @@ static int idmap_lookup_user(
188+
+
171-
     if (status == NO_ERROR) {
189+
+        (void)printf("group_name\t=%s\n", grent.group_name);
172-
         /* don't return expired entries; query new attributes
190+
+        (void)printf("passwd\t=%s\n", grent.passwd);
173-
          * and overwrite the entry with cache_insert() */
191+
+        (void)printf("gidstr\t=%s (%lu)\n", grent.gidstr, (unsigned long)gid);
174-
-        if (time(NULL) - user->last_updated < context->config.cache_ttl)
192+
+        (void)printf("userlist\t=%s\n", grent.userlist);
175-
+        if ((time(NULL) - user->last_updated) < context->config.cache_ttl)
193+
+
176-
             goto out;
194+
+        if (res_group_name)
177-
     }
195+
+            (void)strcpy_s(res_group_name, VAL_LEN, grent.group_name);
178-
-
196+
+        *res_gid = gid;
179-
+#if 0
197+
+        res = 0;
180-
     /* send the query to the ldap server */
198+
+    }
181-
     status = idmap_query_attrs(context, lookup,
199+
+    else
182-
         attributes, optional, values, NUM_ATTRIBUTES);
200+
+    {
183-
@@ -705,7 +856,91 @@ static int idmap_lookup_user(
201+
+        (void)puts("no match for group");
184-
         goto out_free_values;
202+
+    }
193203
+
194-
+	status = ERROR_NOT_FOUND;
204+
+fail:
205+
+    (void)_pclose(getent_pipe);
195206
+
196-
+        if (!cygwin_getent_passwd(lookup->value, NULL, &cy_uid, &cy_gid)) {
207+
+    return res;
197-
+            eprintf("# ATTR_USER_NAME: cygwin_getent_passwd: returned %s, uid=%d, gid=%d\n", lookup->value, (int)cy_uid, (int)cy_gid);
208+
+}
198-
+	    (void)snprintf(principal_name, sizeof(principal_name), "%s@%s", lookup->value, "GLOBAL.LOC");
209+
+#endif /* CYGWIN_GETENT_USERDATA */
199-
+            StringCchCopyA(user->username, VAL_LEN, lookup->value);
210+
200-
+            StringCchCopyA(user->principal, VAL_LEN, principal_name);
211+
 /* generic cache */
201-
+            user->uid = cy_uid;
212+
 typedef struct list_entry* (*entry_alloc_fn)();
202-
+            user->gid = cy_gid;
213+
@@ -665,10 +816,10 @@ static int idmap_lookup_user(
203-
+	    status = 0;
214+
     if (status == NO_ERROR) {
204-
+	}
215+
         /* don't return expired entries; query new attributes
205-
+    }
216+
          * and overwrite the entry with cache_insert() */
206-
+    else if (lookup->attr == ATTR_PRINCIPAL) {
217+
-        if (time(NULL) - user->last_updated < context->config.cache_ttl)
207-
+	char search_name[VAL_LEN];
218+
+        if ((time(NULL) - user->last_updated) < context->config.cache_ttl)
208-
+	char principal_name[VAL_LEN];
219+
             goto out;
209-
+	char *s;
220+
     }
210-
+	uid_t cy_uid = 0;
221+
-
211-
+	gid_t cy_gid = 0;
222+
+#if 0
212-
+
223+
     /* send the query to the ldap server */
213-
+	status = ERROR_NOT_FOUND;
224+
     status = idmap_query_attrs(context, lookup,
214-
+
225+
         attributes, optional, values, NUM_ATTRIBUTES);
215-
+	/*
226+
@@ -705,7 +856,91 @@ static int idmap_lookup_user(
216-
+	 * strip '@' from principal name and use that for getent
227+
         goto out_free_values;
217-
+	 * fixme: This does not work with multiple domains
228+
     }
218-
+	 */
229+
     user->last_updated = time(NULL);
219-
+	(void)strcpy_s(search_name, sizeof(search_name), lookup->value);
230+
-
220-
+	if (s = strchr(search_name, '@'))
231+
+#else
221-
+	    *s = '\0';
232+
+    if (lookup->attr == ATTR_USER_NAME) {
233+
+	char principal_name[VAL_LEN];
222236
+
223-
+        if (!cygwin_getent_passwd(search_name, NULL, &cy_uid, &cy_gid)) {
237+
+	status = ERROR_NOT_FOUND;
226238
+
227-
+	    if (!_stricmp(principal_name, lookup->value)) {
239+
+        if (!cygwin_getent_passwd(lookup->value, NULL, &cy_uid, &cy_gid)) {
228-
+                StringCchCopyA(user->username, VAL_LEN, search_name);
240+
+            eprintf("# ATTR_USER_NAME: cygwin_getent_passwd: returned %s, uid=%d, gid=%d\n", lookup->value, (int)cy_uid, (int)cy_gid);
229-
+                StringCchCopyA(user->principal, VAL_LEN, principal_name);
241+
+	    (void)snprintf(principal_name, sizeof(principal_name), "%s@%s", lookup->value, "GLOBAL.LOC");
230-
+                user->uid = cy_uid;
242+
+            StringCchCopyA(user->username, VAL_LEN, lookup->value);
231-
+                user->gid = cy_gid;
243+
+            StringCchCopyA(user->principal, VAL_LEN, principal_name);
232-
+	        status = 0;
244+
+            user->uid = cy_uid;
233-
+	    }
245+
+            user->gid = cy_gid;
246+
+	    status = 0;
234247
+	}
235248
+    }
236-
+    else if (lookup->attr == ATTR_UID) {
249+
+    else if (lookup->attr == ATTR_PRINCIPAL) {
238250
+	char search_name[VAL_LEN];
240251
+	char principal_name[VAL_LEN];
252+
+	char *s;
241253
+	uid_t cy_uid = 0;
242254
+	gid_t cy_gid = 0;
243255
+
244256
+	status = ERROR_NOT_FOUND;
245257
+
246-
+	(void)snprintf(search_name, sizeof(search_name), "%lu", (unsigned long)search_uid);
258+
+	/*
259+
+	 * strip '@' from principal name and use that for getent
247265
+
248-
+        if (!cygwin_getent_passwd(search_name, res_username, &cy_uid, &cy_gid)) {
266+
+        if (!cygwin_getent_passwd(search_name, NULL, &cy_uid, &cy_gid)) {
249-
+            eprintf("# ATTR_UID: cygwin_getent_passwd: returned %s, uid=%d, gid=%d\n", res_username, (int)cy_uid, (int)cy_gid);
267+
+            eprintf("# ATTR_PRINCIPAL: cygwin_getent_passwd: returned %s, uid=%d, gid=%d\n", lookup->value, (int)cy_uid, (int)cy_gid);
250-
+	    (void)snprintf(principal_name, sizeof(principal_name), "%s@%s", res_username, "GLOBAL.LOC");
268+
+	    (void)snprintf(principal_name, sizeof(principal_name), "%s@%s", lookup->value, "GLOBAL.LOC");
251269
+
252-
+            StringCchCopyA(user->username, VAL_LEN, res_username);
270+
+	    if (!_stricmp(principal_name, lookup->value)) {
253-
+            StringCchCopyA(user->principal, VAL_LEN, principal_name);
271+
+                StringCchCopyA(user->username, VAL_LEN, search_name);
254-
+            user->uid = cy_uid;
272+
+                StringCchCopyA(user->principal, VAL_LEN, principal_name);
255-
+            user->gid = cy_gid;
273+
+                user->uid = cy_uid;
256-
+            status = 0;
274+
+                user->gid = cy_gid;
275+
+	        status = 0;
257277
+	}
258278
+    }
259-
+    else
279+
+    else if (lookup->attr == ATTR_UID) {
260-
+    {
280+
+        uid_t search_uid = (uid_t)(lookup->value);
261-
+        status = ERROR_NOT_FOUND;
281+
+	char search_name[VAL_LEN];
262-
+    }
282+
+	char res_username[VAL_LEN];
283+
+	char principal_name[VAL_LEN];
263286
+
264-
+    if (status == 0) {
287+
+	status = ERROR_NOT_FOUND;
265-
+        user->last_updated = time(NULL);
288+
+
266-
+	eprintf("## idmap_lookup_user: found username='%s', principal='%s', uid=%lu, gid=%lu\n",
289+
+	(void)snprintf(search_name, sizeof(search_name), "%lu", (unsigned long)search_uid);
267-
+		user->username,
290+
+
268-
+		user->principal,
291+
+        if (!cygwin_getent_passwd(search_name, res_username, &cy_uid, &cy_gid)) {
269-
+		(unsigned long)user->uid,
292+
+            eprintf("# ATTR_UID: cygwin_getent_passwd: returned %s, uid=%d, gid=%d\n", res_username, (int)cy_uid, (int)cy_gid);
270-
+		(unsigned long)user->gid);
293+
+	    (void)snprintf(principal_name, sizeof(principal_name), "%s@%s", res_username, "GLOBAL.LOC");
294+
+
271301
+    }
272-
+#endif
302+
+    else
273-
     if (context->config.cache_ttl) {
303+
+    {
274-
         /* insert the entry into the cache */
304+
+        status = ERROR_NOT_FOUND;
275-
         cache_insert(&context->users, lookup, &user->entry);
305+
+    }
276-
@@ -732,10 +967,10 @@ static int idmap_lookup_group(
306+
+
277-
     if (status == NO_ERROR) {
307+
+    if (status == 0) {
278-
         /* don't return expired entries; query new attributes
308+
+        user->last_updated = time(NULL);
279-
          * and overwrite the entry with cache_insert() */
309+
+	eprintf("## idmap_lookup_user: found username='%s', principal='%s', uid=%lu, gid=%lu\n",
280-
-        if (time(NULL) - group->last_updated < context->config.cache_ttl)
310+
+		user->username,
281-
+        if ((time(NULL) - group->last_updated) < context->config.cache_ttl)
311+
+		user->principal,
282-
             goto out;
312+
+		(unsigned long)user->uid,
283-
     }
313+
+		(unsigned long)user->gid);
284-
-
314+
+    }
285-
+#if 0
315+
+#endif
286-
     /* send the query to the ldap server */
316+
     if (context->config.cache_ttl) {
287-
     status = idmap_query_attrs(context, lookup,
317+
         /* insert the entry into the cache */
288-
         attributes, 0, values, NUM_ATTRIBUTES);
318+
         cache_insert(&context->users, lookup, &user->entry);
289-
@@ -758,7 +993,48 @@ static int idmap_lookup_group(
319+
@@ -732,10 +967,10 @@ static int idmap_lookup_group(
290-
         goto out_free_values;
320+
     if (status == NO_ERROR) {
321+
         /* don't return expired entries; query new attributes
291326
     }
327+
-
292335
     group->last_updated = time(NULL);
293336
+#else
294337
+    if (lookup->attr == ATTR_GROUP_NAME) {
295338
+	gid_t cy_gid = 0;
296339
+
297340
+	status = ERROR_NOT_FOUND;
298341
+
299342
+        if (!cygwin_getent_group(lookup->value, NULL, &cy_gid)) {
300343
+            eprintf("# ATTR_GROUP_NAME: cygwin_getent_group: returned %s, gid=%d\n", lookup->value, (int)cy_gid);
301344
+            StringCchCopyA(group->name, VAL_LEN, lookup->value);
302345
+            group->gid = cy_gid;
303346
+	    status = 0;
304347
+	}
305348
+    }
306349
+    else if (lookup->attr == ATTR_GID) {
307350
+        gid_t search_gid = (gid_t)(lookup->value);
308351
+        char search_name[VAL_LEN];
309352
+	char res_groupname[VAL_LEN];
310353
+	gid_t cy_gid = 0;
311354
+
312355
+	status = ERROR_NOT_FOUND;
313356
+
314357
+	(void)snprintf(search_name, sizeof(search_name), "%lu", (unsigned long)search_gid);
315358
+
316359
+        if (!cygwin_getent_group(search_name, res_groupname, &cy_gid)) {
317360
+            eprintf("# ATTR_GID: cygwin_getent_group: returned %s, gid=%d\n", res_groupname, (int)cy_gid);
318361
+            StringCchCopyA(group->name, VAL_LEN, res_groupname);
319362
+            group->gid = cy_gid;
320363
+            status = 0;
321364
+	}
322365
+    }
323366
+    else
324367
+    {
325368
+        status = ERROR_NOT_FOUND;
326369
+    }
327370
328371
+    if (status == 0) {
329372
+        group->last_updated = time(NULL);
330373
+	eprintf("## idmap_lookup_group: found name='%s', gid=%lu\n",
331374
+		group->name,
332375
+		(unsigned long)group->gid);
333376
+    }
334377
+#endif
335378
     if (context->config.cache_ttl) {
336379
         /* insert the entry into the cache */
337380
         cache_insert(&context->groups, lookup, &group->entry);
338381
@@ -795,6 +1071,7 @@ int nfs41_idmap_create(
339382
         goto out_err_free;
340383
     }
341384
342385
+#if 0
343386
     /* initialize ldap and configure options */
344387
     context->ldap = ldap_init(context->config.hostname, context->config.port);
345388
     if (context->ldap == NULL) {
346389
@@ -824,6 +1101,10 @@ int nfs41_idmap_create(
347390
             goto out_err_free;
348391
         }
349392
     }
350393
+#else
351394
+    eprintf("nfs41_idmap_create: Force context->config.timeout = 6000;\n");
352395
+    context->config.timeout = 6000;
353396
+#endif
354397
355398
     *context_out = context;
356399
 out:
357400
diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
358-
index 599f246..895d488 100644
401+
index bb485cb..25ca6eb 100644
359402
--- a/daemon/nfs41_daemon.c
360403
+++ b/daemon/nfs41_daemon.c
361-
@@ -384,9 +384,15 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
404+
@@ -389,6 +389,11 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
362-
 #endif
405+
         exit(1);
363-
     /* acquire and store in global memory current dns domain name.
406+
     }
371407
372408
+#if 1
373409
+    /* force enable for cygwin getent passwd/group testing */
374410
+    cmd_args.ldap_enable = TRUE;
375411
+#endif
412+
+
376413
     nfs41_server_list_init();
377414
378415
     if (cmd_args.ldap_enable) {
379416

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at