• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 通過qmailadmin來實現qmail下的域空間設置

    發表于:2007-07-02來源:作者:點擊數: 標簽:
    我的企業郵局是針對isp做的。用qmail+vpopmail+ mysql +qmailadmin+ezmlm+autorespond+sqwebmail(igenus)來實現的。這個 服務器 上,有很多個域。 對于很多企業郵局提供商,他們提供了郵件空間這個服務。就是說企業可以買一定大小的郵件空間。自己可以任意
    我的企業郵局是針對isp做的。用qmail+vpopmail+mysql+qmailadmin+ezmlm+autorespond+sqwebmail(igenus)來實現的。這個服務器上,有很多個域。

    對于很多企業郵局提供商,他們提供了郵件空間這個服務。就是說企業可以買一定大小的郵件空間。自己可以任意的在指定大小的空間中任意添加、刪除、修改用戶。但是,總空間大小一定。這對于企業來說,是非常方便的。

    一般提供這種功能的郵件,都是大型的商業郵件系統,但是qmail也完全可以實現。在這里,我是修改了qmailadmin,來實現這個功能的。我提供的只是一個初級的模型,大家可以自己再優化。這個軟件的作者,是我的好朋友gadfly,感謝他的無私幫助。希望大家能受到一些啟發,作出更好的程序。這樣的話,也給我一份。:)

    btw:這個軟件我用了很長時間了,大家可以放心,經過我無數次測試和使用的。


    功能說明:

    針對qmailadmin-1.0.6

    1、能夠顯示總共的域空間和已使用空間?,F在只在修改用戶(mod_user.html)和(add_user.html)中顯示這個信息。

    如要其它地方顯示,只要將這行:
    ##X501 ##q&nbsp;##X502 ##Q&nbsp;&nbsp;
    加到你想要的地方就可以。

    2、在增加用戶中,郵箱大小可以有缺省值,由.qmailadmin-limits中的default_quota決定,單位是字節

    3.增加了域空間的限制,在.qmailadmin-limits中的參數default_domain_quota,以M為單位

    4.在增加用戶和修改用戶中,會判斷域限制。如果有這個限制,用戶的大小設置就必須>0。如果沒有,舍為<0時,
    就是無限制。

    安裝方法。
    1、將domain_quota.tgz放到qmailadmin的源碼目錄下, 這個目錄必須先configure過,
    # tar xzvf domain_quota.tgz
    #make

    2、將qmailadmin, en-us, mod_user.html, add_user.html覆蓋相應的文件。

    3、設置.qmailadmin-limits的各個參數。

    4、測試qmailadmin. ok!

    .qmailadmin-limits
    增加一個參數
    default_domain_quota: 以M為單位

    修改en-us,500以后是新加的。
    修改*user.html

    1.顯示已用空間和總空間
    mod_user.html和add_user.html增加一下一行
    ##X501 ##q&nbsp;##X502 ##Q&nbsp;&nbsp;

    在qmailadmin.h中增加:
    #define BYTE2M(size) size/1048576

    extern char DefaultDomainQuota[MAX_BUFF];
    extern char DefaultQuota[MAX_BUFF];

    在limits.c中增加
    memset(DefaultDomainQuota, 0, MAX_BUFF);

    else if ( strncmp(tmpstr, "default_domain_quota", 20) == 0 ) {
    tmpstr = strtok(NULL," :\t\n");
    if (tmpstr==NULL) continue;
    strncpy(DefaultDomainQuota, tmpstr, MAX_BUFF);
    }
    在qmailadmin.c中增加:
    char DefaultDomainQuota[MAX_BUFF];

    在user.c中增加
    /**
    * @return: size M, if return value == -1, no limit.
    */
    #define BYTE2M(size) size/1048576
    int count_users_quota()
    {
    struct vqpasswd *pw;
    int ret = 0;

    pw = vauth_getall(Domain,1,0);
    while(pw!=NULL){
    if (strcmp(pw->pw_shell, "NOQUOTA") == 0) return -1;
    ret += BYTE2M(atol(pw->pw_shell));
    pw = vauth_getall(Domain,0,0);
    }
    return ret;
    }

    在template.c中增加
    case @#Q@#:
    {
    if (DefaultDomainQuota[0]) {
    fprintf(actout, "%sM", DefaultDomainQuota);
    } else {
    fprintf(actout, "%s", NOLIMIT_STR);
    }

    }
    break;

    case @#q@#:
    {
    int usedQuota = count_users_quota();

    if (usedQuota > -1) fprintf(actout, "%dM", usedQuota);
    else fprintf(actout, "%s", NOLIMIT_STR);
    }
    break;

    2.增加和修改個人用戶的時候,顯示大小限制。
    template.c中
    在send_template_now中增加
    case @#R@#:
    {
    if (DefaultQuota[0]) fprintf(actout, "%d", BYTE2M(atol(DefaultQuota)));
    }
    在check_user_forward_vacation中增加
    if ( newchar==@#8@#) {
    if (strcmp(vpw->pw_shell, "NOQUOTA") == 0) {
    fprintf(actout, "%s", NOLIMIT_STR);
    } else {
    fprintf(actout, "%d", BYTE2M(atol(vpw->pw_shell)));
    }
    return;
    }


    3.增加用戶中,設置郵箱大小
    qmailadmin.c 增加
    char Quota[MAX_BUFF];
    memset(Quota,0, MAX_BUFF);

    qmailadmin.h
    #define BYTE2M(size) size/1048576
    #define M2BYTE(size) size*1048576

    extern char DefaultDomainQuota[MAX_BUFF];
    extern char DefaultQuota[MAX_BUFF];
    extern char Quota[MAX_BUFF];

    user.c 函數addusernow中增加

    int user_quota;

    GetValue(TmpCGI, Quota, "quota=", MAX_BUFF);
    user_quota = atoi(Quota);
    if (DefaultDomainQuota[0]) {
    int used_quota = count_users_quota();
    if ( (user_quota <= 0) || (used_quota < 0) ||
    (used_quota + user_quota > atoi(DefaultDomainQuota)) ) {

    sprintf(StatusMessage, "%s\n", get_html_text("504"));
    adduser();
    vclose();
    exit(0);
    }
    }

    /* changed by gadfly@163.com.
    if( DefaultQuota[0]!= 0 ) mypw->pw_shell = DefaultQuota;
    */
    if( user_quota > 0 ) {
    sprintf(Quota, "%d", M2BYTE(user_quota));
    mypw->pw_shell = Quota;
    }

    4.修改用戶中,設置郵件大小,
    user.c 函數modusergo中增加
    int user_quota = 0;
    int old_quota = 0;

    GetValue(TmpCGI, Quota, "quota=", MAX_BUFF);
    user_quota = atoi(Quota);
    old_quota = BYTE2M(atoi(vpw->pw_shell));
    if (DefaultDomainQuota[0]) {
    int used_quota = count_users_quota();
    if ( (user_quota <= 0) || (used_quota < 0) ||
    (used_quota + user_quota - old_quota > atoi(DefaultDomainQuota)) ) {

    sprintf(StatusMessage, "%s\n", get_html_text("504"));
    moduser();
    vclose();
    exit(0);
    }
    }
    if (old_quota != user_quota) {
    if (user_quota < 0) vauth_setquota(ActionUser, Domain, "NOQUOTA");
    else {
    sprintf(Quota, "%d", M2BYTE(user_quota));
    vauth_setquota(ActionUser, Domain, Quota);
    }
    }

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>