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

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

?? hylafaxserver.c++

?? fax相關(guān)的東西
?? C++
?? 第 1 頁 / 共 2 頁
字號:
/*	$Id: HylaFAXServer.c++,v 1.21 2006/06/12 18:28:54 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. */#include "port.h"#include "Sys.h"#include "config.h"#include "tiffio.h"#include "HylaFAXServer.h"#include "Dispatcher.h"#include "StackBuffer.h"#include "Sequence.h"#include <ctype.h>#include <sys/file.h>#include <pwd.h>#include <limits.h>#include <grp.h>#include <unistd.h>#include <stdlib.h>const char* HylaFAXServer::version = HYLAFAX_VERSION;/* * NB: The remainder of the instance state is * initialized in initServer which is expected to * be called before any other operation is done * (through open).  This is required because some * initialization work is done by virtual methods * that cannot be invoked from the constructor. */HylaFAXServer::HylaFAXServer()    : defJob(""){    state = 0;    xferfaxlog = -1;    loginAttempts = 0;		// NB: not reset by REIN command    adminAttempts = 0;		// NB: not reset by REIN command    idcache = NULL;#ifdef HAVE_PAM	pamh = NULL;	pam_chrooted = false;#endif    data = -1;			// current data connection (socket)    pdata = -1;			// passive mode data connect (socket)    faxqFd = -1;    clientFd = -1;    char buff[64];    (void) gethostname(buff, sizeof(buff));    hostname = buff;    hostaddr = "unknown";	// derived classes should fill-in    lastModTime = 0;		// shutdown file mod time    discTime = 0;		// shutdown forced disconnect time    denyTime = 0;		// shutdown service denial time    /*     * Calculate the time differential between the local timezone     * and GMT for adjusting client-specified time values that are     * given in GMT.     *     * We want the actual offset of the local now from UTC,      * This means we have to "force" daylight savings off, otherwise     * the offset we get back is of the real timezone (the time     * functions automatically compensate if DST is set).     *     * Because we take the actual offset instead of a real timezone,     * we force the TZ a format CUT<offset> instead of an actual     * timezone like EST<offset>EDT, or PST<offset>PDT.  This means     * we no longer have to rely on the system being able to do the     * DST offset.     */    time_t now = Sys::now();    struct tm gmt = *gmtime(&now);    struct tm tm = *localtime(&now);    tm.tm_isdst = 0;    gmtoff = mktime(&gmt) - mktime(&tm);#if HAS_TM_ZONE    /*     * BSD/OS doesn't support the global timezone     * information so setup substitutes here.     */    tzname[0] = tm.tm_zone;    tzname[1] = NULL;#endif    /*     * Some versions of  glibc (like RHEL4) will revert to UTC in     * the chroot if it can't find the zoneinfo file and no TZ is     * set in the environment.     * We'll set the TZ to our crafted TZ to make sure that we     * have the right offset even if no timezone DST info is     * available in the chroot.     */    fxStr tz = fxStr::format("CUT%d:%02d",    		(gmtoff / 3600), ((gmtoff / 60) % 60));    setenv("TZ", tz, 0);    cachedTIFF = NULL;}HylaFAXServer::~HylaFAXServer(){    dologout(0);}/* * Initialize the state of the server.  Note that this * is used to implement the REIN command and for that * it doesn't work entirely because state set from the * configuration files is not accessible after a login * because the sever does a chroot to the top of the * spooling area.  The only way to make this work is * to keep all the configuration files in the spooling * area which is not folks want when things are shared * through NFS (i.e. server binaries and config files * are NFS-mounted by the spooling area is private). */voidHylaFAXServer::initServer(void){    end_login();		// reset user-related state    /*     * Default state:     *   o send long replies     *   o use GMT for time values     *   o auto-detect whether filesystem has BSD or SysV     *     semantics for setting the GID on created files     */    state = S_LREPLIES|S_USEGMT|S_CHECKGID;    restart_point = 0;		// data-transfer-related state    mode = MODE_S;    form = FORM_PS;    type = TYPE_A;    stru = STRU_F;    initDefaultJob();		// reset default job state    curJob = &defJob;    if (data != -1)		// data transfer-related state	Sys::close(data), data = -1;    if (pdata != -1)	Sys::close(pdata), pdata = -1;    if (trigSpec != "") {	fxStr emsg;	cancelTrigger(emsg);    }    // XXX FIFO state    pushedToken = T_NIL;    recvCC = 0;			// no data present in buffer    recvNext = 0;    consecutiveBadCmds = 0;    resetConfig();    readConfig(FAX_SYSCONF);    readConfig(FAX_LIBDATA "/hfaxd.conf");}static voidtiffErrorHandler(const char* module, const char* fmt0, va_list ap){    fxStr fmt = (module != 0) ?        fxStr::format("%s: Warning, %s.", module, fmt0)        : fxStr::format("Warning, %s.", fmt0);    vlogError(fmt, ap);}static voidtiffWarningHandler(const char* module, const char* fmt0, va_list ap){    fxStr fmt = (module != 0) ?        fxStr::format("%s: Warning, %s.", module, fmt0)        : fxStr::format("Warning, %s.", fmt0);    vlogWarning(fmt, ap);}voidHylaFAXServer::open(void){    initServer();		// complete state initialization    fxStr emsg;    if (!initClientFIFO(emsg)) {        logInfo("connection refused (%s) from %s [%s]",	    (const char*) emsg,	    (const char*) remotehost, (const char*) remoteaddr);	reply(420, "%s server cannot initialize: %s",	    (const char*) hostname, (const char*) emsg);	dologout(-1);    }    ctrlFlags = fcntl(STDIN_FILENO, F_GETFL);	// for parser    if (isShutdown(true))	reply(220, "%s HylaFAX server shut down; available only for admin use.",	    (const char*) hostname);    else	reply(220, "%s server (%s) ready.", (const char*) hostname, version);    if (TRACE(TIFF)) {	TIFFSetErrorHandler(tiffErrorHandler);	TIFFSetWarningHandler(tiffWarningHandler);    } else {	TIFFSetErrorHandler(NULL);	TIFFSetWarningHandler(NULL);    }}voidHylaFAXServer::close(){    dologout(-1);}voidHylaFAXServer::setupPermissions(void){    uid_t euid = geteuid();    struct passwd* pwd = getpwnam(FAX_USER);    if (!pwd)	logError("No fax user \"%s\" defined on your system!\n"	    "This software is not installed properly!", FAX_USER);    else if (euid == 0) {	if (initgroups(pwd->pw_name, pwd->pw_gid) != 0)	    logError("Can not setup permissions (supplementary groups): %m");	if (setegid(pwd->pw_gid) < 0)	    logError("Can not setup permissions (gid): %m");	else if (seteuid(pwd->pw_uid) < 0)	    logError("Can not setup permissions (uid): %m");	else {	    faxuid = pwd->pw_gid;	    endpwent();	    return;	}    } else {	faxuid = pwd->pw_gid;	uid_t faxuid = pwd->pw_uid;	setpwent();	pwd = getpwuid(euid);	if (!pwd)	    logError("Can not figure out the identity of uid %u", euid);	else if (pwd->pw_uid != faxuid)	    logError("Configuration error; "		"the fax server must run as the fax user \"%s\".", FAX_USER);	else {	    endpwent();	    return;	}    }    exit(-1);}/* * Close all open descriptors and unlink any * Dispatcher i/o handlers. */voidHylaFAXServer::closeAllBut(int fd){    Dispatcher& disp = Dispatcher::instance();    for (int f = Sys::getOpenMax()-1; f >= 0; f--)	if (f != fd) {	    IOHandler* h = disp.handler(f, Dispatcher::ReadMask);	    if (h)		disp.unlink(f);	    Sys::close(f);	}}/* * Unlink all dispatcher i/o handlers and close * their file descriptor. */voidHylaFAXServer::closeAllDispatched(){    Dispatcher& disp = Dispatcher::instance();    for (int f = Sys::getOpenMax()-1; f >= 0; f--)    {	IOHandler* h = disp.handler(f, Dispatcher::ReadMask);	if (h)	{	    disp.unlink(f);	    Sys::close(f);	}    }}const char*HylaFAXServer::fixPathname(const char* file){    return (!IS(LOGGEDIN) && file[0] == '/' ? file+1 : file);}boolHylaFAXServer::readShutdownFile(void){    bool ok = false;    FILE* fd = fopen(fixPathname(shutdownFile), "r");    if (fd != NULL) {	struct tm tm;	int deny, disc;	memset(&tm, 0, sizeof (tm));	int n = fscanf(fd, "%d %d %d %d %d %d %d\n",	    &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min,	    &deny, &disc);	if (n == 7) {	    tm.tm_year -= 1900;	    tm.tm_isdst = -1;	    time_t shut = mktime(&tm);	    if (shut != (time_t) -1) {		denyTime = shut - 3600 * (deny / 100) + 60 * (deny % 100);		discTime = shut - 3600 * (disc / 100) + 60 * (disc % 100);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99在线精品观看| 国产福利一区二区三区视频| 国产亚洲综合色| 欧美r级电影在线观看| 欧美日韩一区三区四区| 色先锋久久av资源部| 色综合欧美在线视频区| 91在线精品一区二区| 99久久精品久久久久久清纯| 99久久99久久久精品齐齐| av资源网一区| 91九色02白丝porn| 91精品国产丝袜白色高跟鞋| 91精品国产91久久久久久最新毛片 | 一区二区欧美在线观看| 亚洲精品乱码久久久久久久久| 亚洲卡通动漫在线| 午夜激情久久久| 免费观看在线综合色| 另类综合日韩欧美亚洲| 国产专区综合网| 91视频91自| 在线播放/欧美激情| 日韩精品一区二区三区在线播放| 久久久久久免费| 亚洲欧美日本在线| 美女视频黄 久久| av一二三不卡影片| 欧美日韩精品一二三区| 久久无码av三级| 一区二区三区久久久| 毛片不卡一区二区| 99精品黄色片免费大全| 7777精品伊人久久久大香线蕉 | 欧美午夜宅男影院| 日韩三级视频中文字幕| 中文字幕在线观看一区二区| 亚洲大片一区二区三区| 国产成人av一区二区三区在线观看| 91女人视频在线观看| 精品国产青草久久久久福利| 亚洲欧美综合色| 激情图区综合网| 欧美日韩在线不卡| 国产精品乱码一区二区三区软件 | 国产一区二区三区蝌蚪| 色婷婷久久久综合中文字幕| www国产亚洲精品久久麻豆| 亚洲精品视频免费观看| 国产成人av电影在线播放| 51精品秘密在线观看| 亚洲精品国产第一综合99久久 | 午夜精品在线看| 99久久精品国产一区二区三区| 欧美电影免费观看高清完整版在线 | 在线观看亚洲一区| 国产精品久久久久久久岛一牛影视| 日本成人在线不卡视频| 欧美在线制服丝袜| 中文字幕一区二区三区乱码在线 | 成人中文字幕电影| 精品国产伦一区二区三区观看体验| 一区二区三区精品| 99在线视频精品| 精品成人佐山爱一区二区| 天天综合网 天天综合色| 色欧美日韩亚洲| 综合分类小说区另类春色亚洲小说欧美| 精品一区二区三区免费播放| 精品视频1区2区3区| 亚洲激情图片小说视频| 91片黄在线观看| 亚洲区小说区图片区qvod| av不卡免费在线观看| 国产精品色噜噜| 不卡av在线网| 亚洲美女在线国产| 欧美午夜电影网| 亚洲午夜三级在线| 欧美日韩情趣电影| 爽爽淫人综合网网站| 欧美高清dvd| 奇米888四色在线精品| 欧美成人性福生活免费看| 免费观看成人鲁鲁鲁鲁鲁视频| 91精品国产综合久久精品| 蜜臀av一级做a爰片久久| 日韩一区和二区| 丁香激情综合国产| 亚洲丝袜制服诱惑| 欧美日韩你懂的| 韩国一区二区视频| 欧美激情在线看| 日本道色综合久久| 青青草97国产精品免费观看 | 亚洲黄色av一区| 欧美在线免费播放| 蜜臀av性久久久久蜜臀av麻豆| 久久天堂av综合合色蜜桃网| 国产91丝袜在线播放九色| 国产精品日韩成人| 欧美伦理视频网站| 国产电影一区在线| 最新国产の精品合集bt伙计| 欧美精品一二三区| 国产高清一区日本| 亚洲高清免费一级二级三级| 亚洲精品在线免费播放| 色综合色综合色综合色综合色综合 | 国产成人在线观看免费网站| 国产精品美女久久久久久久久| 欧美自拍偷拍午夜视频| 麻豆高清免费国产一区| 欧美精品一区二区三区高清aⅴ | 在线免费av一区| 久久不见久久见免费视频1| 中文字幕在线观看不卡视频| 91精品在线免费观看| 成人网页在线观看| 久久国产乱子精品免费女| 亚洲欧洲日本在线| 26uuu欧美| 538prom精品视频线放| 色综合久久久久久久久| 精品一区二区久久| 亚洲黄色免费电影| 国产精品乱码一区二区三区软件| 欧美日韩一二三| 成人动漫一区二区三区| 精品综合免费视频观看| 亚洲第一综合色| 亚洲男人都懂的| 欧美激情在线一区二区| 精品乱人伦小说| 日韩欧美中文字幕制服| 欧美三级欧美一级| 99精品在线观看视频| 国产成人综合亚洲网站| 男女视频一区二区| 日本91福利区| 天堂成人国产精品一区| 亚洲一区二区高清| 一区二区三区蜜桃| 一区二区三区四区精品在线视频| 2021中文字幕一区亚洲| 2020国产成人综合网| 日韩欧美亚洲国产精品字幕久久久| 欧美日韩在线精品一区二区三区激情 | 欧美不卡视频一区| 777奇米四色成人影色区| 欧美视频中文字幕| 精品视频999| 在线不卡中文字幕播放| 欧美男生操女生| 91精品欧美久久久久久动漫| 911精品国产一区二区在线| 欧美精品视频www在线观看| 911国产精品| 日韩女优av电影在线观看| 欧美日韩精品三区| 日韩欧美成人一区二区| 精品区一区二区| 国产亚洲精品aa午夜观看| 国产精品久久久久精k8| 亚洲视频免费观看| 亚洲综合清纯丝袜自拍| 日韩av一区二区三区四区| 蜜桃av噜噜一区二区三区小说| 麻豆成人久久精品二区三区小说| 国内精品久久久久影院一蜜桃| 国产精品中文欧美| 99国产欧美另类久久久精品| 欧美系列在线观看| 精品女同一区二区| 国产精品久久久久毛片软件| 一区二区三区四区中文字幕| 午夜精品一区二区三区电影天堂| 日韩av电影一区| 国产成人av自拍| 一本大道久久精品懂色aⅴ| 欧美日韩精品一区二区| 国产丝袜欧美中文另类| 亚洲最大成人综合| 国产一区美女在线| 91国产免费观看| 久久综合色8888| 亚洲激情五月婷婷| 国产精品影音先锋| 欧美日韩久久不卡| 国产精品女主播av| 日韩中文字幕区一区有砖一区| 国产剧情一区二区| 欧美另类一区二区三区| 亚洲精品一区二区三区精华液| 中文字幕字幕中文在线中不卡视频| 五月开心婷婷久久| 91网页版在线| 国产亚洲欧美日韩俺去了| 三级一区在线视频先锋| www.日韩av|