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

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

?? vpopmail.c

?? 相當優秀的 UNIX 進程管理工具
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* * $Id: vpopmail.c,v 1.28.2.4 2004/06/26 02:20:56 tomcollins Exp $ * Copyright (C) 2000-2002 Inter7 Internet Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include <unistd.h>#include <string.h>#include <pwd.h>#include <sys/stat.h>#include <sys/types.h>#include <sys/wait.h>#ifdef HAVE_SYS_VARARGS_H#include <sys/varargs.h>#endif#include <signal.h>#include <ctype.h>#include <fcntl.h>#include <time.h>#include <dirent.h>#include <pwd.h>#include "config.h"#include "md5.h"#include "vpopmail.h"#include "file_lock.h"#include "vauth.h"#include "vlimits.h"#include "maildirquota.h"#define MAX_BUFF 256#ifdef POP_AUTH_OPEN_RELAY/* keep a output pipe to tcp.smtp file */int tcprules_fdm;static char relay_tempfile[MAX_BUFF];#endifint verrori = 0;extern int cdb_seek();/* Global Flags */int NoMakeIndex = 0;int OptimizeAddDomain = 0;#define PS_TOKENS " \t"#define CDB_TOKENS ":\n\r"#ifdef IP_ALIAS_DOMAINSint host_in_locals(char *domain);#endifstatic char gen_chars[] = "abcdefghijklmnopqrstuvwxyz" \                          "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \                          "0123456789.@!#%*";static char ok_env_chars[] = "abcdefghijklmnopqrstuvwxyz" \                            "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \                            "1234567890_-.@";/************************************************************************//*  * Add a domain to the email system * * input: domain name *        dir to put the files *        uid and gid to assign to the files */int vadddomain( char *domain, char *dir, uid_t uid, gid_t gid ){ FILE *fs; int i; char *domain_hash; char DomainSubDir[MAX_BUFF]; char dir_control_for_uid[MAX_BUFF]; char tmpbuf[MAX_BUFF]; char Dir[MAX_BUFF]; char calling_dir[MAX_BUFF];  /* we only do lower case */  lowerit(domain);  /* reject domain names that are too short to be valid */  if ( strlen( domain) <3) return (VA_INVALID_DOMAIN_NAME);  /* reject domain names that exceed our max permitted/storable size */  if ( strlen( domain ) >= MAX_PW_DOMAIN ) return(VA_DOMAIN_NAME_TOO_LONG);  /* check invalid email domain characters */  for(i=0;domain[i]!=0;++i) {    if (i == 0 && domain[i] == '-' ) return(VA_INVALID_DOMAIN_NAME);    if (isalnum((int)domain[i])==0 && domain[i]!='-' && domain[i]!='.') {      return(VA_INVALID_DOMAIN_NAME);    }  }  if ( domain[i-1] == '-' ) return(VA_INVALID_DOMAIN_NAME);  /* after the name is okay, check if it already exists */  if ( vget_assign(domain, NULL, 0, NULL, NULL ) != NULL ) {    return(VA_DOMAIN_ALREADY_EXISTS);  }   /* set our file creation mask for machines where the   * sysadmin has tightened default permissions   */  umask(VPOPMAIL_UMASK);  /* store the calling directory */  getcwd(calling_dir, sizeof(calling_dir));  /* go to the directory where our Domains dir is to be stored    * check for error and return error on error   */  if ( chdir(dir) != 0 ) return(VA_BAD_V_DIR);  /* go into the Domains subdir */  if ( chdir(DOMAINS_DIR) != 0 ) {    /* if it's not there, no problem, just try to create it */    if ( mkdir(DOMAINS_DIR, VPOPMAIL_DIR_MODE) != 0 ) {      chdir(calling_dir);      return(VA_CAN_NOT_MAKE_DOMAINS_DIR);    }    /*  set the permisions on our new Domains dir */    chown(DOMAINS_DIR,uid,gid);    /* now try moving into the Domains subdir again */    if ( chdir(DOMAINS_DIR) != 0 ) {      chdir(calling_dir);      return(VA_BAD_D_DIR);    }  }  /* since domains can be added under any /etc/passwd   * user, we have to create dir_control information   * for each user/domain combination   */  snprintf(dir_control_for_uid, sizeof(dir_control_for_uid),   "dom_%lu", (long unsigned)uid);  /* work out a subdir name for the domain    * Depending on how many domains we have, it may need to be hashed   */  open_big_dir(dir_control_for_uid, uid, gid);         domain_hash = next_big_dir(uid, gid);  close_big_dir(dir_control_for_uid, uid, gid);        if ( strlen(domain_hash) > 0 ) {    snprintf(DomainSubDir, sizeof(DomainSubDir), "%s/%s", domain_hash, domain);  } else {    snprintf(DomainSubDir,sizeof(DomainSubDir), "%s", domain);  }  /* Check to make sure length of the dir isnt going to exceed   * the maximum storable size   * We dont want to start creating dirs and putting entries in   * the assign file etc if the path is going to be too long   */  if (strlen(dir)+strlen(DOMAINS_DIR)+strlen(DomainSubDir) >= MAX_PW_DIR) {    /* back out of changes made so far */    dec_dir_control(dir_control_for_uid, uid, gid);    chdir(calling_dir);    return(VA_DIR_TOO_LONG);  }  /* Make the subdir for the domain */  if ( r_mkdir(DomainSubDir, uid, gid ) != 0 ) {    /* back out of changes made so far */    dec_dir_control(dir_control_for_uid, uid, gid);    chdir(calling_dir);    return(VA_COULD_NOT_MAKE_DOMAIN_DIR);  }    if ( chdir(DomainSubDir) != 0 ) {    /* back out of changes made so far */    vdelfiles(DomainSubDir);    dec_dir_control(dir_control_for_uid, uid, gid);    chdir(calling_dir);    return(VA_BAD_D_DIR);  }  /* create the .qmail-default file */  snprintf(tmpbuf, sizeof(tmpbuf), "%s/%s/%s/.qmail-default", dir, DOMAINS_DIR,     DomainSubDir);  if ( (fs = fopen(tmpbuf, "w+"))==NULL) {    /* back out of changes made so far */    chdir(dir); chdir(DOMAINS_DIR);    if (vdelfiles(DomainSubDir) != 0) {      fprintf(stderr, "Failed to delete directory tree :%s\n", DomainSubDir);    }    dec_dir_control(dir_control_for_uid, uid, gid);    chdir(calling_dir);    return(VA_COULD_NOT_OPEN_QMAIL_DEFAULT);  } else {    fprintf(fs, "| %s/bin/vdelivermail '' bounce-no-mailbox\n", VPOPMAILDIR);    fclose(fs);  }  /* create an entry in the assign file for our new domain */  snprintf(tmpbuf, sizeof(tmpbuf), "%s/%s/%s", dir, DOMAINS_DIR, DomainSubDir);  if (add_domain_assign( domain, domain, tmpbuf, uid, gid ) != 0) {    /* back out of changes made so far */    chdir(dir); chdir(DOMAINS_DIR);    if (vdelfiles(DomainSubDir) != 0) {      fprintf(stderr, "Failed to delete directory tree: %s\n", DomainSubDir);    }    dec_dir_control(dir_control_for_uid, uid, gid);    chdir(calling_dir);    fprintf (stderr, "Error. Failed to add domain to assign file\n");    return (VA_COULD_NOT_UPDATE_FILE);  }  /* recursively change ownership to new file system entries */  snprintf(tmpbuf, sizeof(tmpbuf), "%s/%s/%s", dir, DOMAINS_DIR, DomainSubDir);  r_chown(tmpbuf, uid, gid);  /* ask the authentication module to add the domain entry */  /* until now we checked if domain already exists in cdb and   * setup all dirs, but vauth_adddomain may __fail__ so we need to check   */  if (vauth_adddomain( domain ) != VA_SUCCESS ) {    /* ok we have run into problems here. adding domain to auth backend failed     * so now we need to reverse the steps we have already performed above      */    fprintf(stderr, "Error. Failed while attempting to add domain to auth backend\n");    chdir(dir); chdir(DOMAINS_DIR);        if (vdelfiles(DomainSubDir) != 0) {      fprintf(stderr, "Failed to delete directory tree: %s\n", DomainSubDir);    }    dec_dir_control(dir_control_for_uid, uid, gid);    vget_assign(domain, Dir, sizeof(Dir), &uid, &gid );    if ( del_domain_assign(domain, domain, Dir, uid, gid) != 0) {      fprintf(stderr, "Failed while attempting to remove domain from assign file\n");    }    if (del_control(domain) !=0) {      fprintf(stderr, "Failed while attempting to delete domain from the qmail control files\n");    }    if (vdel_dir_control(domain) != 0) {      fprintf (stderr, "Failed while attempting to delete domain from dir_control\n");    }    /* send a HUP signal to qmail-send process to reread control files */    signal_process("qmail-send", SIGHUP);    return (VA_NO_AUTH_CONNECTION);  }	   /* ask qmail to re-read it's new control files */  if ( OptimizeAddDomain == 0 ) {    signal_process("qmail-send", SIGHUP);  }  /* return back to the callers directory and return success */  chdir(calling_dir);  return(VA_SUCCESS);}/************************************************************************//* Delete a domain from the entire mail system * * If we have problems at any of the following steps, it has been  * decided that the best course of action is to continue rather than * abort. The idea behind this is to allow the removal of a partially * installed domain. We will emit warnings should any of the expected * cleanup steps fail. */int vdeldomain( char *domain ){ struct stat statbuf; char Dir[MAX_BUFF]; char domain_to_del[MAX_BUFF]; char dircontrol[MAX_BUFF]; uid_t uid; gid_t gid;  /* we always convert domains to lower case */  lowerit(domain);  /* Check the length of the domain to del   * If it exceeds the max storable size,    * then the user has made some sort of error in    * asking to del that domain, because such a domain   * wouldnt be able to exist in the 1st place   */  if (strlen(domain) >= MAX_PW_DOMAIN) return (VA_DOMAIN_NAME_TOO_LONG);  /* now we want to check a couple for things :   * a) if the domain to del exists in the system   * b) if the domain to del is an aliased domain or not   */  /* Take a backup of the domain we want to del,   * because when we call vget_assign, if the domain   * is an alias, then the domain parameter will be   * rewritten on return as the name of the real domain   */  snprintf(domain_to_del, sizeof(domain_to_del), "%s", domain);  /* check if the domain exists. If so extract the dir, uid, gid */  if (vget_assign(domain, Dir, sizeof(Dir), &uid, &gid ) == NULL) {    return(VA_DOMAIN_DOES_NOT_EXIST);  }  /* if this is an NOT aliased domain....   * (aliased domains dont have any filestructure of their own)   */  if ( strcmp(domain_to_del, domain) == 0 ) {    /* check if the domain's dir exists */    if ( stat(Dir, &statbuf) != 0 ) {      fprintf(stderr, "Warning: Could not access (%s)\n",Dir);    }    /*     * Michael Bowe 23rd August 2003     *     * at this point, we need to write some code to check if any alias domains     * point to this (real) domain. If we find such aliases, then I guess we     * have a couple of options :     * 1. Abort with an error, saying cant delete domain until all     *    aliases are removed 1st (list them)     * 2. Zap all the aliases in additon to this domain     *     */    /* call the auth module to delete the domain from the storage */    /* Note !! We must del domain from auth module __before__ we delete it from     * fs, because deletion from auth module may fail !!!!     */    /* del a domain from the auth backend which includes :     * - drop the domain's table, or del all users from users table     * - delete domain's entries from lastauth table     * - delete domain's limit's entries     */    if (vauth_deldomain(domain) != VA_SUCCESS ) {      fprintf (stderr, "Warning: Failed while attempting to delete domain from auth backend\n");    }    /* vdel_limits does the following :     * If we have mysql_limits enabled,     *  it will delete the domain's entries from the limits table     * Or if we arent using mysql_limits,     *  it will delete the .qmail-admin file from the domain's dir     *     * Note there are inconsistencies in the auth backends.  Some     * will run vdel_limits() in vauth_deldomain(), others don't.     * For now, we always run it to be safe.  Ultimately, the auth     * backends should to be updated to do this.     */      vdel_limits(domain);    /* delete the dir control info for this domain */    if (vdel_dir_control(domain) != 0) {      fprintf (stderr, "Warning: Failed to delete dir_control for %s\n", domain);    }    /* Now remove domain from filesystem */    /* if it's a symbolic link just remove the link */    if ( S_ISLNK(statbuf.st_mode) ) {      if ( unlink(Dir) !=0) {        fprintf (stderr, "Warning: Failed to remove symlink for %s\n", domain);      }    } else {      char cwdbuff[MAX_BUFF];      char *cwd;      /* Not a symlink.. so we have to del some files structure now */      /* zap the domain's directory tree */      cwd = getcwd (cwdbuff, sizeof(cwdbuff));  /* save calling directory */      if ( vdelfiles(Dir) != 0 ) {        fprintf(stderr, "Warning: Failed to delete directory tree: %s\n", domain);      }      if (cwd != NULL) chdir (cwd);    }    /* decrement the master domain control info */    snprintf(dircontrol, sizeof(dircontrol), "dom_%lu", (long unsigned)uid);    dec_dir_control(dircontrol, uid, gid);  }  /* The following things need to happen for real and aliased domains */  /* delete the email domain from the qmail control files :   * rcpthosts, morercpthosts, virtualdomains   */  if (del_control(domain_to_del) != 0) {    fprintf (stderr, "Warning: Failed to delete domain from qmail's control files\n");  }  /* delete the assign file line */  if (del_domain_assign(domain_to_del, domain, Dir, uid, gid) != 0) {    fprintf (stderr, "Warning: Failed to delete domain from the assign file\n");  }  /* send a HUP signal to qmail-send process to reread control files */  signal_process("qmail-send", SIGHUP);  return(VA_SUCCESS);}/************************************************************************//* * Add a virtual domain user */int vadduser( char *username, char *domain, char *password, char *gecos,               int apop ){ char Dir[MAX_BUFF]; char *user_hash; char calling_dir [MAX_BUFF]; uid_t uid = VPOPMAILUID; gid_t gid = VPOPMAILGID; struct vlimits limits; char quota[50];  /* check gecos for : characters - bad */  if ( strchr(gecos,':')!=0) return(VA_BAD_CHAR);  if ( strlen(username) >= MAX_PW_NAME ) return(VA_USER_NAME_TOO_LONG);#ifdef USERS_BIG_DIR  if ( strlen(username) == 1 ) return(VA_ILLEGAL_USERNAME);#endif  if ( strlen(domain) >= MAX_PW_DOMAIN ) return(VA_DOMAIN_NAME_TOO_LONG);  if ( strlen(domain) < 3) return(VA_INVALID_DOMAIN_NAME);  if ( strlen(password) >= MAX_PW_CLEAR_PASSWD ) return(VA_PASSWD_TOO_LONG);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品99999| 91精品91久久久中77777| eeuss鲁片一区二区三区在线看| 北岛玲一区二区三区四区| 欧美亚洲一区二区在线观看| 欧美一级一区二区| 亚洲国产电影在线观看| 亚洲综合激情另类小说区| 奇米影视一区二区三区小说| 国产成人av影院| 欧美中文字幕一二三区视频| 日韩免费高清av| 中文字幕日本不卡| 日韩成人伦理电影在线观看| 成人免费黄色在线| 欧美日韩在线不卡| 国产欧美一区二区精品久导航| 亚洲三级在线免费| 免费xxxx性欧美18vr| 成人禁用看黄a在线| 91精品国产综合久久久久久| 中文成人av在线| 日韩在线一区二区| 成人免费毛片a| 欧美高清视频在线高清观看mv色露露十八| 久久综合中文字幕| 亚洲成在人线免费| 岛国av在线一区| 日韩三级av在线播放| 亚洲美女偷拍久久| 国产成a人亚洲精品| 欧美高清视频不卡网| 国产精品久久综合| 久久er99精品| 精品视频一区二区三区免费| 中文字幕不卡的av| 久久99日本精品| 欧美性大战久久| 成人欧美一区二区三区小说| 精一区二区三区| 欧美中文字幕一区二区三区亚洲| 国产精品日日摸夜夜摸av| 美女任你摸久久| 欧美日韩久久久一区| 亚洲欧美福利一区二区| 国产成人午夜精品5599| 欧美一区二区福利视频| 亚洲综合视频在线| 99精品1区2区| 国产精品网站在线| 国产丶欧美丶日本不卡视频| 日韩丝袜情趣美女图片| 午夜av一区二区| 色94色欧美sute亚洲线路二| 国产精品久久久久影院色老大 | 在线观看日产精品| 国产人妖乱国产精品人妖| 美女网站色91| 欧美一区二区啪啪| 五月综合激情日本mⅴ| 欧美影院午夜播放| 一区二区三区国产精华| 色综合天天综合网天天狠天天| 国产欧美一区二区在线观看| 国产剧情一区二区三区| 精品久久一二三区| 久久国产欧美日韩精品| 日韩免费电影一区| 免费不卡在线观看| 欧美刺激脚交jootjob| 日本aⅴ精品一区二区三区| 91精品国产一区二区三区| 香蕉成人啪国产精品视频综合网| 日本韩国视频一区二区| 一个色妞综合视频在线观看| 91久久久免费一区二区| 尤物视频一区二区| 在线观看成人小视频| 性欧美疯狂xxxxbbbb| 欧美日韩日本视频| 日本在线播放一区二区三区| 欧美一区二区三区色| 蜜臀精品一区二区三区在线观看 | 亚洲综合一区二区| 在线亚洲高清视频| 亚洲18色成人| 6080午夜不卡| 精品一区二区影视| 精品久久一区二区三区| 国产在线国偷精品产拍免费yy| 26uuu色噜噜精品一区| 国产乱码精品一区二区三| 欧美国产综合色视频| 成人免费看的视频| 亚洲在线中文字幕| 欧美男人的天堂一二区| 麻豆一区二区三区| 国产片一区二区| 日本大香伊一区二区三区| 亚洲不卡在线观看| 精品对白一区国产伦| 成人激情综合网站| 亚洲国产视频a| 精品免费国产二区三区| 国产成人在线免费观看| 亚洲精品视频在线观看免费| 欧美日韩久久一区二区| 国产毛片一区二区| 国产精品黄色在线观看| 欧美无砖专区一中文字| 久久成人久久爱| 中文字幕一区二区三中文字幕| 欧美视频在线一区二区三区| 久久99国产精品免费| 国产精品福利av| 欧美久久婷婷综合色| 国产高清一区日本| 一卡二卡欧美日韩| 亚洲精品一区二区三区精华液| 成人高清免费在线播放| 日韩经典一区二区| 中文乱码免费一区二区| 欧美精品欧美精品系列| 国产91综合一区在线观看| 亚洲图片欧美视频| 国产性做久久久久久| 欧美日韩亚洲不卡| 国产91高潮流白浆在线麻豆| 亚洲成人资源在线| 国产亚洲综合性久久久影院| 欧美色区777第一页| 国产xxx精品视频大全| 午夜国产精品影院在线观看| 国产精品美女一区二区| 欧美一区二区视频网站| 91蝌蚪国产九色| 国产高清不卡二三区| 天堂va蜜桃一区二区三区漫画版| 国产精品久久一级| 久久亚洲精品国产精品紫薇| 欧美三级韩国三级日本一级| 国产99久久久久| 久久精品二区亚洲w码| 一区二区三区中文字幕精品精品 | 成人毛片视频在线观看| 日本在线播放一区二区三区| 亚洲免费成人av| 国产精品美女久久福利网站| 日韩一区二区在线观看视频| 色综合天天综合网天天狠天天| 国产大陆精品国产| 美女视频网站黄色亚洲| 亚洲午夜精品久久久久久久久| 亚洲国产精品99久久久久久久久| 日韩一区二区免费在线电影| 欧美四级电影网| 99精品视频在线观看| 风间由美一区二区av101 | 国产亚洲制服色| 日韩欧美久久久| 91精品国产一区二区三区蜜臀| 91搞黄在线观看| 91在线精品一区二区| 国产寡妇亲子伦一区二区| 久久国产欧美日韩精品| 免费美女久久99| 日本aⅴ亚洲精品中文乱码| 亚洲国产精品久久久久婷婷884 | 日本韩国欧美一区| 不卡一卡二卡三乱码免费网站| 国产一区二区三区免费| 久久99国内精品| 久久精品99久久久| 久久国产精品露脸对白| 另类小说色综合网站| 欧美国产日韩在线观看| 国产女人18毛片水真多成人如厕| 精品国产乱码久久久久久牛牛 | 亚洲高清视频中文字幕| 亚洲色图20p| 亚洲另类一区二区| 亚洲视频一区在线观看| 亚洲人一二三区| 亚洲欧美电影一区二区| 一区二区三区在线播| 亚洲精品写真福利| 一区二区三区中文字幕电影| 亚洲精品国产视频| 亚洲自拍偷拍图区| 亚洲国产另类av| 日产国产高清一区二区三区| 美洲天堂一区二卡三卡四卡视频 | 精品久久久影院| 亚洲精品在线观看视频| 久久午夜羞羞影院免费观看| 久久久久99精品一区| 国产欧美精品一区二区色综合朱莉| 国产三级精品三级| 中文字幕在线一区| 一区二区三区日本|