Tcl Source Code

Changes On Branch bug-9e6b569963
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch bug-9e6b569963 Excluding Merge-Ins

This is equivalent to a diff from 34e362c775 to c471b6d83a

2018-06-04
13:52
merge 8.5 check-in: a9a4a69e99 user: sebres tags: core-8-6-branch
2018-05-31
20:31
merge 8.6 check-in: e7c436046f user: jan.nijtmans tags: zipfs
13:41
fix 1st issue of [75ecc0e6cb9899bf]: retrieve correct environment-depended encoding (avoid mistaken ... check-in: 5b6e4aeee0 user: sebres tags: fix-initsubsystem-75ecc0e6cb9899bf
2018-05-29
17:58
back-porting of tclclockmod done, merge current 8.6 check-in: 913e5f51f9 user: sebres tags: sebres-8-6-clock-speedup-cr2
07:23
merge 8.6 check-in: fc277d3663 user: jan.nijtmans tags: core-8-branch
2018-05-28
13:39
reintegrate 8.6 (after merge with sebres-bug-9e6b569963-8-5-branch) back to bug-9e6b569963 (acceptin... Closed-Leaf check-in: c471b6d83a user: sebres tags: bug-9e6b569963
13:17
merge 8.5 check-in: 34e362c775 user: sebres tags: core-8-6-branch
13:13
win: searching for FQDN in user-name should be utf-8 safe (user-name could contain non-ascii utf-8 c... check-in: 318c6b1966 user: sebres tags: core-8-5-branch
12:26
merge 8.5 (conflicts resolved, rewritten without winapi-stubs) check-in: a2b0c73364 user: sebres tags: core-8-6-branch
2018-05-24
20:51
Remove test filesystem-1.30.3, this is unstestable check-in: 88b6a0b3db user: fvogel tags: bug-9e6b569963

Changes to win/tclWinFile.c.

1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450

1451















1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
    const char *name,		/* User name for desired home directory. */
    Tcl_DString *bufferPtr)	/* Uninitialized or free DString filled with
				 * name of user's home directory. */
{
    char *result = NULL;
    USER_INFO_1 *uiPtr;
    Tcl_DString ds;
    int nameLen = -1;
    int rc = 0;
    const char *domain;
    WCHAR *wName, *wHomeDir, *wDomain;
    WCHAR buf[MAX_PATH];

    Tcl_DStringInit(bufferPtr);

    wDomain = NULL;

    domain = Tcl_UtfFindFirst(name, '@');















    if (domain == NULL) {
	const char *ptr;
	
	/* no domain - firstly check it's the current user */
	if ( (ptr = TclpGetUserName(&ds)) != NULL 
	  && strcasecmp(name, ptr) == 0
	) {
	    /* try safest and fastest way to get current user home */
	    ptr = TclGetEnv("HOME", &ds);
	    if (ptr != NULL) {
		Tcl_JoinPath(1, &ptr, bufferPtr);
		rc = 1;
		result = Tcl_DStringValue(bufferPtr);
	    }
	}
	Tcl_DStringFree(&ds);
    } else {
	Tcl_DStringInit(&ds);
	wName = Tcl_UtfToUniCharDString(domain + 1, -1, &ds);
	rc = NetGetDCName(NULL, wName, (LPBYTE *) &wDomain);
	Tcl_DStringFree(&ds);
	nameLen = domain - name;
    }
    if (rc == 0) {
	Tcl_DStringInit(&ds);
	wName = Tcl_UtfToUniCharDString(name, nameLen, &ds);
	while (NetUserGetInfo(wDomain, wName, 1, (LPBYTE *) &uiPtr) != 0) {
	    /* 
	     * user does not exists - if domain was not specified,







|








>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


















|


<







1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488

1489
1490
1491
1492
1493
1494
1495
    const char *name,		/* User name for desired home directory. */
    Tcl_DString *bufferPtr)	/* Uninitialized or free DString filled with
				 * name of user's home directory. */
{
    char *result = NULL;
    USER_INFO_1 *uiPtr;
    Tcl_DString ds;
    int nameLen = -1, domainLen = -1;
    int rc = 0;
    const char *domain;
    WCHAR *wName, *wHomeDir, *wDomain;
    WCHAR buf[MAX_PATH];

    Tcl_DStringInit(bufferPtr);

    wDomain = NULL;
    /* try user@domain format */
    domain = Tcl_UtfFindFirst(name, '@');
    if (domain == NULL) {
    	/* try domain\user format */
	const char *user = Tcl_UtfFindFirst(name, '\\');
	if (user != NULL) {
	    /* domain\user */
	    domain = name;
	    domainLen = user - domain;
	    name = user + 1;
	}
	/* else user without domain */
    } else {
    	/* user@domain */
    	nameLen = domain - name;
	domain++;
    }
    if (domain == NULL) {
	const char *ptr;
	
	/* no domain - firstly check it's the current user */
	if ( (ptr = TclpGetUserName(&ds)) != NULL 
	  && strcasecmp(name, ptr) == 0
	) {
	    /* try safest and fastest way to get current user home */
	    ptr = TclGetEnv("HOME", &ds);
	    if (ptr != NULL) {
		Tcl_JoinPath(1, &ptr, bufferPtr);
		rc = 1;
		result = Tcl_DStringValue(bufferPtr);
	    }
	}
	Tcl_DStringFree(&ds);
    } else {
	Tcl_DStringInit(&ds);
	wName = Tcl_UtfToUniCharDString(domain, domainLen, &ds);
	rc = NetGetDCName(NULL, wName, (LPBYTE *) &wDomain);
	Tcl_DStringFree(&ds);

    }
    if (rc == 0) {
	Tcl_DStringInit(&ds);
	wName = Tcl_UtfToUniCharDString(name, nameLen, &ds);
	while (NetUserGetInfo(wDomain, wName, 1, (LPBYTE *) &uiPtr) != 0) {
	    /* 
	     * user does not exists - if domain was not specified,