root/alternc/branches/larpoux-unstable/src/db_create.c

Revision 6, 1.8 kB (checked in by anarcat, 3 years ago)

[project @ alternc: changeset 2003-03-27 00:42:15 by benjamin]
ajout des scripts shells d'AlternC

Original author: benjamin
Date: 2003-03-27 00:42:19

Line 
1 /*
2  $Id: db_create.c,v 1.1 2003/03/27 00:42:19 benjamin Exp $
3  ----------------------------------------------------------------------
4  AlternC - Web Hosting System
5  Copyright (C) 2002 by the AlternC Development Team.
6  http://alternc.org/
7  ----------------------------------------------------------------------
8  Based on:
9  Valentin Lacambre's web hosting softwares: http://altern.org/
10  ----------------------------------------------------------------------
11  LICENSE
12
13  This program is free software; you can redistribute it and/or
14  modify it under the terms of the GNU General Public License (GPL)
15  as published by the Free Software Foundation; either version 2
16  of the License, or (at your option) any later version.
17
18  This program is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  GNU General Public License for more details.
22
23  To read the license please visit http://www.gnu.org/copyleft/gpl.html
24  ----------------------------------------------------------------------
25  Original Author of file: Benjamin Sonntag - 2002/06/22
26  Purpose of file: Change the owner / mod of a newly created db
27  ----------------------------------------------------------------------
28 */
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <sys/types.h>
32 #include <sys/quota.h>
33
34 int main(int argc,char *argv[])
35 {
36         unsigned int uid,size;
37         int i;
38         char res[255];
39         struct dqblk addr;
40
41   if (argc!=3)
42     {
43       printf("Utilisation : %s uid login\n  ",argv[0]);
44       printf("Change le possesseur et le groupe de la base mysql 'login' pour le groupe 'uid'\n");
45       exit(-1);
46     }
47         uid=atoi(argv[1]);
48         if (!uid)
49                 exit(-1);
50
51         setuid(geteuid());
52                 /*************************/
53                 /* WARNING : ROOT ZONE ! */
54                 /*************************/
55         chown(argv[2],-1,uid);
56         chmod(argv[2],02770);
57         exit(0);
58 }
59
Note: See TracBrowser for help on using the browser.