openvds-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Openvds-devel] vsd_map_read()


From: Damion Parry
Subject: Re: [Openvds-devel] vsd_map_read()
Date: Thu, 16 May 2002 16:23:14 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020408

Hello again,

What problems exactly, it all seemed to work for me.

Damion.

Lev V. Vanyan wrote:
-----BEGIN PGP SIGNED MESSAGE-----

I wrote a small test (something familiar to vsdvirtuald), but it unable to read vsd config. I have had some problems with compilation, but now it is ok (thx to Damion Parry).
Any suggestions ? Here is a full test of this source:


/*********************************************************************
* Written by Lev V. Vanyan <address@hidden>
* Mirotel LTD, Kyiv, Ukraine
* This is free software, so you can distribute under the terms and
* conditions of GNU Public License ("GPL"). I take NO RESPONCEBILITY
* for any kind of damage this software could give. So you are on your
* own.
*
* Send your bug reports to address@hidden
*
* Based on virtuald.c from freevsd's source tree
* Should be compiled within VSD source tree
*
**********************************************************************/
#include "main.h"
#include "vsd.h"
#include "libvsd.h"
int touch_mailbox (char* domain_name,char* mailbox_name) {
        int result = -1;
        char* vs_root,*cmd_line = (char*) malloc (1024);
        struct vsd_vs *vd;
        struct vsd_vs_map *vsd_map;
        struct connection *vsd_con =
                (struct connection*) malloc (sizeof(struct connection));
vsd_map = vsd_map_read();
        if( vsd_map == NULL ) {
#ifndef ALWAYS_SILENT
                puts("\ttouch_mailbox(): unable to read vsd config");
#endif
                goto touch_end;
        }
        vd = vsd_getvdent(vsd_map,domain_name);
        if( vd == NULL ) {
#ifndef ALWAYS_SILENT
                printf("\ttouch_mailbox(): unable to find domain %s\n",
                        domain_name);
#endif
                goto touch_end;
 }
        vs_root = (char*) vsd_map_server_root(vsd_map,vd->name);
        if(chroot(vs_root) != 0) {
#ifndef ALWAYS_SILENT
puts("\ttouch_mailbox(): unable to chroot() to virtual server");
#endif
                goto touch_end;
        }
        chdir("/");
initgroups("root",0);
        sprintf(cmd_line,"/bin/touch %s/%s/%s",
                VS_MAILBOX_PATH,domain_name,mailbox_name);
#ifndef ALWAYS_SILENT
        puts(cmd_line);
#endif
        system(cmd_line);
        sprintf(cmd_line,"/bin/chmod 640 %s/%s/%s",
                VS_MAILBOX_PATH,domain_name,mailbox_name);
#ifndef ALWAYS_SILENT
        puts(cmd_line);
#endif
        system(cmd_line);
        sprintf(cmd_line,"/bin/chown mail:admin %s/%s/%s",
                VS_MAILBOX_PATH,domain_name,mailbox_name);
#ifndef ALWAYS_SILENT
        puts(cmd_line);
#endif
        system(cmd_line);
        result = 0;
touch_end:
        return result;
}
/* src end */

- -- Lev V. Vanyan System Administrator
Mirotel ISP                      nic-hdl: VL1580-RIPE, LV2560-NIC
mailto: address@hidden
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3a
Charset: noconv

iQB1AwUBPOO6fs9Sz223N4s1AQHJtwMAqaAJZVfguFOzIwL/TGOr5maaiNuUFUwE
7VHmbKNx2W9pqzBx3NTVjJnGqujtLAmoNxNHKQi4jU422cuoX5sh/drj7afJop0Z
2jjsxAPt67gRTdAUL8k3TVsihxKdETdN
=RJgj
-----END PGP SIGNATURE-----

_______________________________________________
Openvds-devel mailing list
address@hidden
http://mail.freesoftware.fsf.org/mailman/listinfo/openvds-devel






reply via email to

[Prev in Thread] Current Thread [Next in Thread]