亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? sys.c

?? 這學(xué)期的os課程設(shè)計(jì)的
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):

	if (capable(CAP_SETGID))
		current->gid = current->egid = current->sgid = current->fsgid = gid;
	else if ((gid == current->gid) || (gid == current->sgid))
		current->egid = current->fsgid = gid;
	else
		return -EPERM;

	if (current->egid != old_egid)
		current->dumpable = 0;
	return 0;
}
  
/* 
 * cap_emulate_setxuid() fixes the effective / permitted capabilities of
 * a process after a call to setuid, setreuid, or setresuid.
 *
 *  1) When set*uiding _from_ one of {r,e,s}uid == 0 _to_ all of
 *  {r,e,s}uid != 0, the permitted and effective capabilities are
 *  cleared.
 *
 *  2) When set*uiding _from_ euid == 0 _to_ euid != 0, the effective
 *  capabilities of the process are cleared.
 *
 *  3) When set*uiding _from_ euid != 0 _to_ euid == 0, the effective
 *  capabilities are set to the permitted capabilities.
 *
 *  fsuid is handled elsewhere. fsuid == 0 and {r,e,s}uid!= 0 should 
 *  never happen.
 *
 *  -astor 
 */
extern inline void cap_emulate_setxuid(int old_ruid, int old_euid, 
				       int old_suid)
{
	if ((old_ruid == 0 || old_euid == 0 || old_suid == 0) &&
	    (current->uid != 0 && current->euid != 0 && current->suid != 0)) {
		cap_clear(current->cap_permitted);
		cap_clear(current->cap_effective);
	}
	if (old_euid == 0 && current->euid != 0) {
		cap_clear(current->cap_effective);
	}
	if (old_euid != 0 && current->euid == 0) {
		current->cap_effective = current->cap_permitted;
	}
}

/*
 * Unprivileged users may change the real uid to the effective uid
 * or vice versa.  (BSD-style)
 *
 * If you set the real uid at all, or set the effective uid to a value not
 * equal to the real uid, then the saved uid is set to the new effective uid.
 *
 * This makes it possible for a setuid program to completely drop its
 * privileges, which is often a useful assertion to make when you are doing
 * a security audit over a program.
 *
 * The general idea is that a program which uses just setreuid() will be
 * 100% compatible with BSD.  A program which uses just setuid() will be
 * 100% compatible with POSIX with saved IDs. 
 */
asmlinkage int sys_setreuid(uid_t ruid, uid_t euid)
{
	int old_ruid, old_euid, old_suid, new_ruid;

	new_ruid = old_ruid = current->uid;
	old_euid = current->euid;
	old_suid = current->suid;
	if (ruid != (uid_t) -1) {
		if ((old_ruid == ruid) || 
		    (current->euid==ruid) ||
		    capable(CAP_SETUID))
			new_ruid = ruid;
		else
			return -EPERM;
	}
	if (euid != (uid_t) -1) {
		if ((old_ruid == euid) ||
		    (current->euid == euid) ||
		    (current->suid == euid) ||
		    capable(CAP_SETUID))
			current->fsuid = current->euid = euid;
		else
			return -EPERM;
	}
	if (ruid != (uid_t) -1 ||
	    (euid != (uid_t) -1 && euid != old_ruid))
		current->suid = current->euid;
	current->fsuid = current->euid;
	if (current->euid != old_euid)
		current->dumpable = 0;

	if(new_ruid != old_ruid) {
		/* What if a process setreuid()'s and this brings the
		 * new uid over his NPROC rlimit?  We can check this now
		 * cheaply with the new uid cache, so if it matters
		 * we should be checking for it.  -DaveM
		 */
		free_uid(current);
		current->uid = new_ruid;
		alloc_uid(current);
	}
	
	if (!issecure(SECURE_NO_SETUID_FIXUP)) {
		cap_emulate_setxuid(old_ruid, old_euid, old_suid);
	}

	return 0;
}


		
/*
 * setuid() is implemented like SysV with SAVED_IDS 
 * 
 * Note that SAVED_ID's is deficient in that a setuid root program
 * like sendmail, for example, cannot set its uid to be a normal 
 * user and then switch back, because if you're root, setuid() sets
 * the saved uid too.  If you don't like this, blame the bright people
 * in the POSIX committee and/or USG.  Note that the BSD-style setreuid()
 * will allow a root program to temporarily drop privileges and be able to
 * regain them by swapping the real and effective uid.  
 */
asmlinkage int sys_setuid(uid_t uid)
{
	int old_euid = current->euid;
	int old_ruid, old_suid, new_ruid;

	old_ruid = new_ruid = current->uid;
	old_suid = current->suid;
	if (capable(CAP_SETUID))
		new_ruid = current->euid = current->suid = current->fsuid = uid;
	else if ((uid == current->uid) || (uid == current->suid))
		current->fsuid = current->euid = uid;
	else
		return -EPERM;

	if (current->euid != old_euid)
		current->dumpable = 0;

       if (new_ruid != old_ruid) {
		/* See comment above about NPROC rlimit issues... */
		free_uid(current);
		current->uid = new_ruid;
		alloc_uid(current);
	}

	if (!issecure(SECURE_NO_SETUID_FIXUP)) {
		cap_emulate_setxuid(old_ruid, old_euid, old_suid);
	}

	return 0;
}


/*
 * This function implements a generic ability to update ruid, euid,
 * and suid.  This allows you to implement the 4.4 compatible seteuid().
 */
asmlinkage int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid)
{
	int old_ruid = current->uid;
	int old_euid = current->euid;
	int old_suid = current->suid;

	if (!capable(CAP_SETUID)) {
		if ((ruid != (uid_t) -1) && (ruid != current->uid) &&
		    (ruid != current->euid) && (ruid != current->suid))
			return -EPERM;
		if ((euid != (uid_t) -1) && (euid != current->uid) &&
		    (euid != current->euid) && (euid != current->suid))
			return -EPERM;
		if ((suid != (uid_t) -1) && (suid != current->uid) &&
		    (suid != current->euid) && (suid != current->suid))
			return -EPERM;
	}
	if (ruid != (uid_t) -1) {
		/* See above commentary about NPROC rlimit issues here. */
		free_uid(current);
		current->uid = ruid;
		alloc_uid(current);
	}
	if (euid != (uid_t) -1) {
		if (euid != current->euid)
			current->dumpable = 0;
		current->euid = euid;
		current->fsuid = euid;
	}
	if (suid != (uid_t) -1)
		current->suid = suid;

	if (!issecure(SECURE_NO_SETUID_FIXUP)) {
		cap_emulate_setxuid(old_ruid, old_euid, old_suid);
	}

	return 0;
}

asmlinkage int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid)
{
	int retval;

	if (!(retval = put_user(current->uid, ruid)) &&
	    !(retval = put_user(current->euid, euid)))
		retval = put_user(current->suid, suid);

	return retval;
}

/*
 * Same as above, but for rgid, egid, sgid.
 */
asmlinkage int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid)
{
       if (!capable(CAP_SETGID)) {
		if ((rgid != (gid_t) -1) && (rgid != current->gid) &&
		    (rgid != current->egid) && (rgid != current->sgid))
			return -EPERM;
		if ((egid != (gid_t) -1) && (egid != current->gid) &&
		    (egid != current->egid) && (egid != current->sgid))
			return -EPERM;
		if ((sgid != (gid_t) -1) && (sgid != current->gid) &&
		    (sgid != current->egid) && (sgid != current->sgid))
			return -EPERM;
	}
	if (rgid != (gid_t) -1)
		current->gid = rgid;
	if (egid != (gid_t) -1) {
		if (egid != current->egid)
			current->dumpable = 0;
		current->egid = egid;
		current->fsgid = egid;
	}
	if (sgid != (gid_t) -1)
		current->sgid = sgid;
	return 0;
}

asmlinkage int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid)
{
	int retval;

	if (!(retval = put_user(current->gid, rgid)) &&
	    !(retval = put_user(current->egid, egid)))
		retval = put_user(current->sgid, sgid);

	return retval;
}


/*
 * "setfsuid()" sets the fsuid - the uid used for filesystem checks. This
 * is used for "access()" and for the NFS daemon (letting nfsd stay at
 * whatever uid it wants to). It normally shadows "euid", except when
 * explicitly set by setfsuid() or for access..
 */
asmlinkage int sys_setfsuid(uid_t uid)
{
	int old_fsuid;

	old_fsuid = current->fsuid;
	if (uid == current->uid || uid == current->euid ||
	    uid == current->suid || uid == current->fsuid || 
	    capable(CAP_SETUID))
		current->fsuid = uid;
	if (current->fsuid != old_fsuid)
		current->dumpable = 0;

	/* We emulate fsuid by essentially doing a scaled-down version
	 * of what we did in setresuid and friends. However, we only
	 * operate on the fs-specific bits of the process' effective
	 * capabilities 
	 *
	 * FIXME - is fsuser used for all CAP_FS_MASK capabilities?
	 *          if not, we might be a bit too harsh here.
	 */
	
	if (!issecure(SECURE_NO_SETUID_FIXUP)) {
		if (old_fsuid == 0 && current->fsuid != 0) {
			cap_t(current->cap_effective) &= ~CAP_FS_MASK;
		}
		if (old_fsuid != 0 && current->fsuid == 0) {
			cap_t(current->cap_effective) |=
				(cap_t(current->cap_permitted) & CAP_FS_MASK);
		}
	}

	return old_fsuid;
}

/*
 * Samma p

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品综合av一区二区国产馆| 国产一区欧美二区| 久久久久久久久免费| 91久久精品一区二区二区| 狠狠色狠狠色综合日日91app| 中文字幕一区三区| 成人成人成人在线视频| 奇米综合一区二区三区精品视频 | 久久久久九九视频| 欧美午夜视频网站| 成人黄色小视频| 激情综合亚洲精品| 性欧美大战久久久久久久久| 国产精品视频一二三| 日韩欧美中文字幕精品| 91行情网站电视在线观看高清版| 国产一区二区0| 视频一区二区欧美| 一区二区三区四区不卡在线| 久久久欧美精品sm网站| 在线综合视频播放| 欧美性大战xxxxx久久久| 成人涩涩免费视频| 国产精一区二区三区| 免费看欧美美女黄的网站| 亚洲一区二区三区四区五区黄| 亚洲国产精品精华液ab| 精品久久一区二区| 日韩欧美在线网站| 欧美人牲a欧美精品| 在线免费一区三区| 91丨九色丨蝌蚪丨老版| 成人手机电影网| 国产一区91精品张津瑜| 久久成人羞羞网站| 久久国产免费看| 极品少妇一区二区| 国内精品免费**视频| 精品在线观看免费| 国产一区二区三区在线观看免费| 美女爽到高潮91| 九九视频精品免费| 国产精品一区二区在线播放| 国产在线乱码一区二区三区| 久久爱www久久做| 国产一区二区三区不卡在线观看| 国产在线不卡一卡二卡三卡四卡| 狠狠色综合播放一区二区| 黄色精品一二区| 国产不卡免费视频| eeuss影院一区二区三区| 一本色道a无线码一区v| 日本道在线观看一区二区| 色呦呦一区二区三区| 欧美专区在线观看一区| 欧美日韩国产系列| 日韩午夜三级在线| 久久伊99综合婷婷久久伊| 欧美韩国日本一区| 亚洲精品国产高清久久伦理二区| 亚洲影视在线播放| 欧美aaa在线| 国产精品99久久久久久久vr| 成人av先锋影音| 欧美亚洲综合色| 777奇米成人网| 久久久噜噜噜久久人人看| 中文字幕亚洲视频| 五月激情六月综合| 国产一区视频导航| 在线观看一区不卡| 日韩欧美一区电影| 国产精品热久久久久夜色精品三区| 一区二区三区小说| 久久精品国产亚洲aⅴ| eeuss鲁片一区二区三区在线看| 精品视频999| 久久久久国产免费免费| 亚洲欧美激情在线| 久久精品72免费观看| 99精品国产热久久91蜜凸| 欧美一区二区三区在线电影 | 日韩欧美国产成人一区二区| 国产日产亚洲精品系列| 亚洲在线观看免费视频| 国产精品亚洲一区二区三区在线 | 久久精品国产精品亚洲综合| 成人av资源下载| 欧美一区在线视频| 亚洲天堂中文字幕| 久久av中文字幕片| 在线亚洲一区观看| 国产亚洲美州欧州综合国| 一区二区三区国产精华| 韩国一区二区在线观看| 欧美日韩一区二区三区在线看| 久久免费偷拍视频| 日本va欧美va瓶| 91免费国产视频网站| 精品国产乱码久久久久久闺蜜 | 久久综合久久综合九色| 一区二区三区免费| 成人一二三区视频| 欧美大片顶级少妇| 午夜精品免费在线观看| 99精品视频在线播放观看| 精品久久久久久久人人人人传媒| 夜夜精品浪潮av一区二区三区| 国产精品一区二区在线播放| 日韩免费一区二区三区在线播放| 亚洲成人中文在线| 91福利国产精品| 亚洲欧洲成人精品av97| 国产精品18久久久久久久网站| 日韩一区二区三| 午夜天堂影视香蕉久久| 在线观看日韩av先锋影音电影院| 最新久久zyz资源站| 成人性生交大片免费看在线播放| 精品精品欲导航| 男女男精品网站| 欧美高清视频一二三区| 亚洲电影一级黄| 欧美日韩一区二区三区四区| 一区二区三区**美女毛片| 91在线国产观看| 亚洲欧洲精品天堂一级| av中文字幕一区| 国产精品国产三级国产a| 成人av免费在线观看| 国产精品久久久久久久久果冻传媒| 国产伦精品一区二区三区免费| 精品国产区一区| 国产精品18久久久久久久久久久久| 久久这里只有精品6| 国产精品资源网| 久久久国产综合精品女国产盗摄| 国产一区二区h| 亚洲国产成人在线| 99综合影院在线| 亚洲午夜羞羞片| 欧美精选一区二区| 久久精品久久精品| 国产婷婷色一区二区三区四区| 国产精品综合一区二区| 国产精品女同一区二区三区| 成人av电影免费在线播放| 亚洲三级电影全部在线观看高清| 91精品福利在线| 午夜免费久久看| 日韩精品在线看片z| 亚洲免费在线观看| 日本精品视频一区二区| 亚洲一二三级电影| 欧美一区二区三区不卡| 久久成人久久鬼色| 国产精品素人一区二区| 色狠狠色狠狠综合| 日韩中文字幕亚洲一区二区va在线| 欧美一区二区在线看| 极品少妇xxxx偷拍精品少妇| 国产精品久久一卡二卡| 日本高清不卡视频| 久久精品99久久久| 国产精品久久久久永久免费观看| 欧美亚洲高清一区二区三区不卡| 人禽交欧美网站| 亚洲国产精品国自产拍av| 99久久免费精品高清特色大片| 一区av在线播放| 亚洲欧美怡红院| 欧美在线999| 久久精品国产一区二区三区免费看| 日本一区二区三区在线观看| 91官网在线免费观看| 国产乱一区二区| 亚洲夂夂婷婷色拍ww47| 久久综合九色综合97婷婷女人 | 91丨九色丨尤物| 日韩一区精品字幕| 日本一区二区成人在线| 在线播放中文字幕一区| 成人免费视频视频在线观看免费 | 国产精品一级片在线观看| 亚洲视频一区二区免费在线观看| 91麻豆精品国产综合久久久久久| 国产精品99久久久久| 视频一区二区三区中文字幕| 国产精品视频一二| 日韩亚洲欧美在线| 99久久精品免费看国产免费软件| 日产精品久久久久久久性色 | 久久99精品国产麻豆婷婷洗澡| **欧美大码日韩| 精品欧美一区二区在线观看| 欧美少妇一区二区| 高清视频一区二区| 麻豆一区二区三| 一区二区三区四区在线播放| 欧美激情一区不卡|