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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? filesystem.c++

?? fax相關的東西
?? C++
?? 第 1 頁 / 共 2 頁
字號:
/*	$Id: FileSystem.c++,v 1.11 2006/09/21 09:13:42 aidan Exp $ *//* * Copyright (c) 1995-1996 Sam Leffler * Copyright (c) 1995-1996 Silicon Graphics, Inc. * HylaFAX is a trademark of Silicon Graphics * * Permission to use, copy, modify, distribute, and sell this software and  * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. *  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.   *  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE  * OF THIS SOFTWARE. *//* * File commands other than transfer. */#include "HylaFAXServer.h"#include "Sys.h"#include "tiffio.h"#include <limits.h>#include <ctype.h>/* * Delete a file (submitted document or received facsimile). */voidHylaFAXServer::deleCmd(const char* pathname){    struct stat sb;    SpoolDir* dir = fileAccess(pathname, W_OK, sb);    if (dir) {	if (!IS(PRIVILEGED)) {	    if (!S_ISREG(sb.st_mode)) {		reply(550, "%s: not a plain file.", pathname);		return;	    }	    if (!dir->deleAble) {		perror_reply(550, pathname, EPERM);		return;	    }	}	/*	 * XXX must decide what to do with jobs/documents/etc...	 * XXX e.g. should job be treated like jdele; should we	 * XXX cross-check document use for consistency....	 */	if (Sys::unlink(pathname) < 0)	    perror_reply(550, pathname, errno);	else {	    const char* cp = strrchr(pathname, '/');	    logNotice("%s of %s [%s] deleted %s%s"		, (const char*) the_user		, (const char*) remotehost		, (const char*) remoteaddr		, dir->pathname, cp ? cp+1 : pathname	    );	    ack(250, cmdToken(T_DELE));	    FileCache::flush(pathname);	}    }}/* * Set ownership of a file. */voidHylaFAXServer::chownCmd(const char* pathname, const char* user){    struct stat sb;    SpoolDir* dir = fileAccess(pathname, W_OK, sb);    if (dir) {	u_int id;	if (isdigit(user[0]))	    id = (u_int) atoi(user);	else if (!userID(user, id))	    return;	if (!FileCache::chown(pathname, sb.st_uid, (gid_t) id))	    perror_reply(550, pathname, errno);	else	    ack(250, cmdToken(T_CHOWN));    }}/* * Set protection of a file. */voidHylaFAXServer::chmodCmd(const char* pathname, u_int mode){    struct stat sb;    SpoolDir* dir = fileAccess(pathname, W_OK, sb);    if (dir) {	mode = 0600 | (mode&066);	if (!FileCache::chmod(pathname, mode))	    perror_reply(550, pathname, errno);	else	    ack(250, cmdToken(T_CHMOD));    }}/* * Return the last modification time for a file. */voidHylaFAXServer::mdtmCmd(const char* pathname){    struct stat sb;    SpoolDir* dir = fileAccess(pathname, X_OK, sb);    if (dir) {	struct tm* t = cvtTime(sb.st_mtime);	reply(213, "%d%02d%02d%02d%02d%02d"	    , t->tm_year+1900	    , t->tm_mon+1	    , t->tm_mday	    , t->tm_hour	    , t->tm_min	    , t->tm_sec	);    }}/* * NB: this array is ordered by expected frequency of access. */SpoolDir HylaFAXServer::dirs[] = {{ "/status/",	false, false, false, 0,  &HylaFAXServer::isVisibletrue,  &HylaFAXServer::listStatus,	&HylaFAXServer::listStatusFile,  &HylaFAXServer::nlstStatus,	&HylaFAXServer::nlstUnixFile, },{ "/sendq/",	false, false, false, 0,  &HylaFAXServer::isVisibleSendQFile,  &HylaFAXServer::listSendQ,	&HylaFAXServer::listSendQFile,  &HylaFAXServer::nlstSendQ,	&HylaFAXServer::nlstSendQFile, },{ "/doneq/",	false, false, false, 0,  &HylaFAXServer::isVisibleSendQFile,  &HylaFAXServer::listSendQ,	&HylaFAXServer::listSendQFile,  &HylaFAXServer::nlstSendQ,	&HylaFAXServer::nlstSendQFile, },{ "/docq/",	false,  true,  true, 0,  &HylaFAXServer::isVisibleDocQFile,  &HylaFAXServer::listDirectory,	&HylaFAXServer::listUnixFile,  &HylaFAXServer::nlstDirectory,	&HylaFAXServer::nlstUnixFile, },{ "/tmp/",	false,  true,  true, 0,  &HylaFAXServer::isVisibletrue,  &HylaFAXServer::listDirectory,	&HylaFAXServer::listUnixFile,  &HylaFAXServer::nlstDirectory,	&HylaFAXServer::nlstUnixFile, },{ "/log/",	false, false, false, 0,  &HylaFAXServer::isVisibletrue,  &HylaFAXServer::listDirectory,	&HylaFAXServer::listUnixFile,  &HylaFAXServer::nlstDirectory,	&HylaFAXServer::nlstUnixFile, },{ "/recvq/",	false, false,  true, 0,  &HylaFAXServer::isVisibleRecvQFile,  &HylaFAXServer::listRecvQ,	&HylaFAXServer::listRecvQFile,  &HylaFAXServer::nlstDirectory,	&HylaFAXServer::nlstUnixFile, },{ "/archive/",	false, false, false, 0,  &HylaFAXServer::isVisibletrue,  &HylaFAXServer::listDirectory,	&HylaFAXServer::listUnixFile,  &HylaFAXServer::nlstDirectory,	&HylaFAXServer::nlstUnixFile, },{ "/pollq/",	false,  true,  true, 0,  &HylaFAXServer::isVisibleRecvQFile,  &HylaFAXServer::listRecvQ,	&HylaFAXServer::listRecvQFile,  &HylaFAXServer::nlstDirectory,	&HylaFAXServer::nlstUnixFile, },{ "/",		false, false, false, 0,  &HylaFAXServer::isVisibleRootFile,  &HylaFAXServer::listDirectory,	&HylaFAXServer::listUnixFile,  &HylaFAXServer::nlstDirectory,	&HylaFAXServer::nlstUnixFile, },{ "/etc/",	 true, false, false, 0,  &HylaFAXServer::isVisibletrue,  &HylaFAXServer::listDirectory,	&HylaFAXServer::listUnixFile,  &HylaFAXServer::nlstDirectory,	&HylaFAXServer::nlstUnixFile, },{ "/info/",	false, false, false, 0,  &HylaFAXServer::isVisibletrue,  &HylaFAXServer::listDirectory,	&HylaFAXServer::listUnixFile,  &HylaFAXServer::nlstDirectory,	&HylaFAXServer::nlstUnixFile, },{ "/bin/",	 true, false, false, 0,  &HylaFAXServer::isVisibletrue,  &HylaFAXServer::listDirectory,	&HylaFAXServer::listUnixFile,  &HylaFAXServer::nlstDirectory,	&HylaFAXServer::nlstUnixFile, },{ "/config/",	false, false, false, 0,  &HylaFAXServer::isVisibletrue,  &HylaFAXServer::listDirectory,	&HylaFAXServer::listUnixFile,  &HylaFAXServer::nlstDirectory,	&HylaFAXServer::nlstUnixFile, },{ "/client/",	 true, false, false, 0,  &HylaFAXServer::isVisibletrue,  &HylaFAXServer::listDirectory,	&HylaFAXServer::listUnixFile,  &HylaFAXServer::nlstDirectory,	&HylaFAXServer::nlstUnixFile, },};#define	N(a)	(sizeof (a) / sizeof (a[0]))/* * Initialize the directory handling. */voidHylaFAXServer::dirSetup(void){    for (u_int i = 0, n = N(dirs); i < n; i++) {	struct stat sb;	if (!FileCache::lookup(dirs[i].pathname, sb) || !S_ISDIR(sb.st_mode)) {	    logError("%s: Not a directory.", dirs[i].pathname);	    continue;	}	dirs[i].ino = sb.st_ino;	if (streq(dirs[i].pathname, "/"))	    cwd = &dirs[i];    }}/* * Return a directory handle given a pathname. */SpoolDir*HylaFAXServer::dirLookup(const char* path){    struct stat sb;    return (!FileCache::lookup(path, sb) || !S_ISDIR(sb.st_mode) ?	(SpoolDir*) NULL : dirLookup(sb.st_ino));}/* * Return a directory handle given an inode number. */SpoolDir*HylaFAXServer::dirLookup(ino_t ino){    for (u_int i = 0, n = N(dirs); i < n; i++)	if (dirs[i].ino == ino)	    return (&dirs[i]);    return (NULL);}/* * Check if the client is permitted to do the * request operation on the specified file. * Operations are: X_OK (list/stat), R_OK (look * at the contents), W_OK (write/delete contents). * * If the operation is permitted the stat result * for the target file is returned to the caller * for use in futher checks (e.g. type of file). */SpoolDir*HylaFAXServer::fileAccess(const char* path, int op, struct stat& sb){    if (!FileCache::lookup(path, sb)) {			// file not found	if (op != W_OK || errno != ENOENT) {	    perror_reply(550, path, errno);	    return (NULL);	}	/*	 * The file does not exist, fake up the	 * information that would result from a	 * successful file creation--for use below.	 */	sb.st_mode = S_IFREG|S_IRGRP|S_IWGRP;	sb.st_gid = (gid_t) uid;	sb.st_ino = 0;					// NB: to be created    }    /*     * Validate containing directory and target file.     * The directory must exist and the client must     * have permission to access it.  The target file     * must not be a directory if the client is about     * to do a read/write-style operation or the target     * file must be owned by the client (other checks     * are left to the caller).     */    struct stat db;    const char* cp = strrchr(path, '/');    if (cp) {	cp++;						// include "/"	if (!FileCache::lookup(fxStr(path, cp-path), db)) {	    perror_reply(550, path, ENOENT);	    return (NULL);	}    } else {	if (!FileCache::lookup(cwd->pathname, db)) {	// implicit ref to "."	    perror_reply(550, path, ENOENT);	    return (NULL);	}	cp = path;    }    SpoolDir* dir = dirLookup(db.st_ino);    if (!dir) {						// no containing dir	perror_reply(550, path, ENOENT);	return (NULL);    } else if (!IS(PRIVILEGED)) {			// unprivileged client	if (dir->adminOnly) {				// requires admin priv's	    perror_reply(550, path, EPERM);	    return (NULL);	} else if (!fileVisible(*dir, cp, sb)) {	// not visible w/o admin	    perror_reply(550, path, EPERM);	    return (NULL);	} else if (op != X_OK) {			// client wants to r/w	    if (S_ISDIR(sb.st_mode)) {			// cannot r/w directory		reply(550, "%s: not a plain file.", path);		return (NULL);	    } else if (sb.st_ino == 0 && !dir->storAble) {		perror_reply(550, path, EPERM);		// cannot stor in dir.		return (NULL);	    }	    /*	     * Check file protection mode; we use the	     * normal ``other'' bits for public access	     * and the group bits for the ``fax uid''.	     */	    if ((sb.st_mode&op) == 0 &&			// !pubicly accessible	      (sb.st_gid != (gid_t) uid ||		// !owner	       ((sb.st_mode>>3)&op) == 0)) {		// !owner acessible		perror_reply(550, path, EPERM);		return (NULL);	    }	}    } else {						// privileged client	if (op != X_OK && S_ISDIR(sb.st_mode)) {	// cannot r/w directory	    reply(550, "%s: not a plain file.", path);	    return (NULL);	}    }    return (dir);}/* * Like fileAccess, but when the target is a directory. * The implicit operation is X_OK and the directory handle * returned is for the target, not the containing directory. */SpoolDir*HylaFAXServer::dirAccess(const char* path){    struct stat sb;    if (!FileCache::lookup(path, sb)) {			// file not found	perror_reply(550, path, errno);	return (NULL);    }    if (!S_ISDIR(sb.st_mode)) {	perror_reply(550, path, ENOTDIR);	return (NULL);    }    // NB: this assumes all directories are top-level    SpoolDir* dir = dirLookup(sb.st_ino);    if (!dir) {						// XXX should not happen	perror_reply(550, path, ENOENT);	return (NULL);    } else if (dir->adminOnly && !IS(PRIVILEGED)) {	// requires admin priv's	perror_reply(550, path, EPERM);	return (NULL);    }    return (dir);}/* * Force the specified file to have the GID setup as * the effective GID of the process.  On System-V-style * filesystems this happens automatically and there is * nothing to do.  On BSD-style filesystems however the * file's GID is set from the GID of the containing * directory so we must explicitly set the value.  Note * that we must auto-detect the appropriate semantics * because some systems support both styles and the * specific scheme is selectable on a per-filesystem * basis (e.g. IRIX). */voidHylaFAXServer::setFileOwner(const char* file){    if (IS(CHECKGID)) {				// auto-detect how GID handled        struct stat sb;        if (!FileCache::lookup(file, sb)) {            fatal("setFileOwner called for non-existent file (check)");        }        if (sb.st_gid != (gid_t) uid) {            state |= S_SETGID;			// not set, must force it        } else {            state &= ~S_SETGID;			// set by OS, no work to do        }        if (TRACE(SERVER)) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区影院| 久久夜色精品一区| 精品国产凹凸成av人网站| 国产日韩av一区二区| 丝袜美腿亚洲综合| 一本到一区二区三区| 日韩午夜电影在线观看| 一区二区三区日韩精品视频| 国产美女久久久久| 91精品福利在线一区二区三区| 亚洲欧美色综合| 国产成人综合网| 日韩精品中午字幕| 午夜成人免费视频| 91亚洲国产成人精品一区二区三 | 日本久久电影网| 久久综合网色—综合色88| 亚洲午夜一区二区| 99精品视频一区| 中文字幕国产一区| 国产精品一区二区免费不卡| 欧美一级欧美一级在线播放| 亚洲免费观看在线视频| 高清不卡在线观看| 日韩精品中文字幕一区二区三区 | 激情久久久久久久久久久久久久久久| 欧美丰满少妇xxxxx高潮对白| 亚洲激情自拍视频| 91精品福利在线| 一区二区三区av电影| 91国产精品成人| 一区二区在线观看不卡| 91麻豆国产精品久久| 亚洲欧美日韩在线播放| 在线观看视频91| 亚洲最大色网站| 91在线播放网址| 毛片一区二区三区| 韩国v欧美v亚洲v日本v| 日韩一区二区免费在线电影| 久热成人在线视频| 欧美日本一区二区| 蜜桃视频一区二区三区| 日韩美一区二区三区| 久久精品国产久精国产| 久久亚洲欧美国产精品乐播| 国产伦理精品不卡| 国产精品嫩草99a| 91在线精品秘密一区二区| 亚洲自拍与偷拍| 9191久久久久久久久久久| 日韩av一区二| 久久久精品免费网站| 91在线丨porny丨国产| 亚洲成精国产精品女| 日韩情涩欧美日韩视频| 丁香一区二区三区| 亚洲激情校园春色| 91精品国产91热久久久做人人| 国产综合久久久久影院| 1000精品久久久久久久久| 欧美日韩国产精选| 国产麻豆视频一区二区| 亚洲激情自拍偷拍| 日韩一区二区不卡| av电影天堂一区二区在线 | 久久99热这里只有精品| 国产精品久久午夜| 欧美私模裸体表演在线观看| 久久国产视频网| 国产精品久久久久久久久免费樱桃 | 午夜精品久久久| 久久蜜臀精品av| 91行情网站电视在线观看高清版| 美腿丝袜亚洲综合| 日韩一区中文字幕| 欧美电影免费提供在线观看| 91丨九色丨尤物| 精品一区二区三区视频| 伊人婷婷欧美激情| 国产女同性恋一区二区| 欧美日韩免费电影| 国v精品久久久网| 青青草伊人久久| 夜夜爽夜夜爽精品视频| 久久夜色精品国产欧美乱极品| 欧美三级三级三级爽爽爽| 成人国产精品免费网站| 精品在线你懂的| 亚洲成人tv网| 亚洲免费视频成人| 中文字幕免费在线观看视频一区| 欧美一区二区视频免费观看| 色美美综合视频| av成人老司机| 国产99久久久久| 国产一区二区三区黄视频| 一区二区三区中文在线| 亚洲欧洲日产国码二区| 国产欧美日本一区二区三区| 日韩欧美中文字幕公布| 欧美日韩精品欧美日韩精品| 91久久香蕉国产日韩欧美9色| 国产不卡视频一区二区三区| 国产综合色产在线精品| 美国毛片一区二区| 蜜臀av亚洲一区中文字幕| 婷婷久久综合九色综合绿巨人| 亚洲精品中文在线影院| ●精品国产综合乱码久久久久 | 亚洲欧美激情小说另类| 中文字幕国产一区| 国产亚洲一区二区在线观看| 欧美成人女星排行榜| 精品国产凹凸成av人网站| 精品久久一二三区| 久久亚洲一级片| 中文字幕精品一区二区三区精品| 国产亚洲一区二区在线观看| 国产精品天天摸av网| 欧美国产一区在线| 中文字幕一区二区三区在线不卡 | 精品毛片乱码1区2区3区| 日韩欧美一区二区免费| 日韩欧美在线一区二区三区| 欧美一区二区在线播放| 精品乱人伦小说| 亚洲国产精品ⅴa在线观看| 综合网在线视频| 一区二区三区在线观看欧美| 亚洲国产精品人人做人人爽| 婷婷成人激情在线网| 七七婷婷婷婷精品国产| 九九**精品视频免费播放| 丰满岳乱妇一区二区三区| 一本一道久久a久久精品综合蜜臀| 色综合久久中文字幕综合网| 欧美理论片在线| 亚洲精品在线网站| 国产精品美女久久久久aⅴ| 一区二区三区鲁丝不卡| 日韩1区2区3区| 成人激情免费电影网址| 欧美三区在线视频| 欧美videofree性高清杂交| 中文字幕免费观看一区| 一区二区三区在线看| 乱中年女人伦av一区二区| 懂色av一区二区三区免费看| 欧美午夜理伦三级在线观看| 日韩精品中文字幕一区| 中文字幕日本不卡| 婷婷国产在线综合| 国产91清纯白嫩初高中在线观看| 欧洲色大大久久| 久久天天做天天爱综合色| 亚洲免费观看高清完整版在线| 午夜精品一区二区三区电影天堂 | 一本色道久久加勒比精品| 91麻豆精品91久久久久久清纯| 国产免费成人在线视频| 天天色图综合网| 国产91精品露脸国语对白| 在线播放日韩导航| 国产精品嫩草影院av蜜臀| 青青草97国产精品免费观看| 91蜜桃免费观看视频| 久久网这里都是精品| 视频一区在线视频| 91在线国产福利| 国产午夜三级一区二区三| 日韩国产在线一| 色综合天天综合色综合av| 久久久亚洲午夜电影| 午夜精品成人在线| 97se狠狠狠综合亚洲狠狠| 久久久久久久电影| 日日欢夜夜爽一区| 欧亚洲嫩模精品一区三区| 亚洲国产精品精华液2区45| 麻豆成人av在线| 在线不卡免费av| 亚洲成av人在线观看| 91麻豆免费视频| 国产精品电影院| 国产成人av电影在线| 亚洲精品在线免费观看视频| 五月天激情综合| 欧美午夜不卡在线观看免费| 综合久久久久综合| 暴力调教一区二区三区| 国产午夜精品一区二区三区嫩草| 日本中文字幕一区二区视频| 欧美日韩在线免费视频| 亚洲精品久久久蜜桃| 色哟哟一区二区在线观看| 日韩理论片中文av| 91网上在线视频| 亚洲黄色免费电影| 欧美偷拍一区二区|