Check-in [6f341b0c52]
Overview
SHA1:6f341b0c52d4253e3bee946c6cb6424a66882f66
Date: 2017-01-10 21:22:12
User: rkeene
Comment:Implemented "setuid"
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2017-01-10
21:23
[59157f7f93] Fixed "setuid" to not return in failure when it succeeds (user: rkeene, tags: trunk)
21:22
[6f341b0c52] Implemented "setuid" (user: rkeene, tags: trunk)
21:18
[268ce6158e] Implemented "getuid" (user: rkeene, tags: trunk)
Changes

Modified tuapi.c from [9641ecfb8b] to [1d22e5c805].

639
640
641
642
643
644
645






















646
647
648
649
650
651
652
653
static int tuapi_mknod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));

	return(TCL_ERROR);
}

static int tuapi_setuid(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {






















	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));

	return(TCL_ERROR);
}

static int tuapi_getuid(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	uid_t uid;
	Tcl_WideInt tclUid;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
static int tuapi_mknod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));

	return(TCL_ERROR);
}

static int tuapi_setuid(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	Tcl_WideInt tclUid;
	uid_t uid;
	int chk_ret;

	if (objc != 2) {
		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::setuid uid\"", -1));
	}

	chk_ret = Tcl_GetWideIntFromObj(interp, objv[1], &tclUid);
	if (chk_ret != TCL_OK) {
		return(chk_ret);
	}

	uid = tclUid;

	chk_ret = setuid(uid);
	if (chk_ret != 0) {
		Tcl_SetObjResult(interp, Tcl_NewStringObj("setuid failed", -1));

		return(TCL_ERROR);
	}

	Tcl_SetObjResult(interp, Tcl_NewStringObj("", -1));

	return(TCL_ERROR);
}

static int tuapi_getuid(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	uid_t uid;
	Tcl_WideInt tclUid;