1 /*
2 * h_mkd.c
3 * (C)1998-2011 by Marc Huber <Marc.Huber@web.de>
4 * All rights reserved.
5 *
6 * $Id: h_mkd.c,v 1.10 2015/03/14 06:11:25 marc Exp marc $
7 *
8 */
9
10 #include "headers.h"
11
12 static const char rcsid[] __attribute__ ((used)) = "$Id: h_mkd.c,v 1.10 2015/03/14 06:11:25 marc Exp marc $";
13
h_mkd(struct context * ctx,char * arg)14 void h_mkd(struct context *ctx, char *arg)
15 {
16 char *t;
17 struct stat st;
18
19 DebugIn(DEBUG_COMMAND);
20
21 if ((t = buildpath(ctx, arg)) && !pickystat_path(ctx, &st, t) &&
22 (acl_set_umask(ctx, arg, t), (!ctx->anonymous || check_incoming(ctx, t, 0))) && !mkdir(t, ctx->chmod_dirmask | (0755 & ~ctx->umask)))
23 reply(ctx, MSG_250_Directory_created);
24 else
25 reply(ctx, MSG_550_Permission_denied);
26
27 DebugOut(DEBUG_COMMAND);
28 }
29