Check-in [6f341b0c52]
Overview
Comment:Implemented "setuid"
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6f341b0c52d4253e3bee946c6cb6424a66882f66
User & Date: rkeene on 2017-01-10 21:22:12
Other Links: manifest | tags
Context
2017-01-10
21:23
Fixed "setuid" to not return in failure when it succeeds check-in: 59157f7f93 user: rkeene tags: trunk
21:22
Implemented "setuid" check-in: 6f341b0c52 user: rkeene tags: trunk
21:18
Implemented "getuid" check-in: 268ce6158e 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;