1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-02 00:22:11 +03:00

More pstring removal. This one was tricky. I had to add

one horror (pstring_clean_name()) which will have to
remain until I've removed all pstrings from the client code.
Jeremy.
(This used to be commit 1ea3ac8014)
This commit is contained in:
Jeremy Allison
2007-11-15 14:19:52 -08:00
parent 8e1b0f81c2
commit 68be9a8200
24 changed files with 628 additions and 321 deletions

View File

@ -177,19 +177,19 @@ static struct {
#ifdef HAVE_XFS_QUOTAS
{"xfs", sys_get_xfs_quota, sys_set_xfs_quota},
#endif /* HAVE_XFS_QUOTAS */
{NULL, NULL, NULL}
{NULL, NULL, NULL}
};
static int command_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp)
{
const char *get_quota_command;
char **lines = NULL;
get_quota_command = lp_get_quota_command();
if (get_quota_command && *get_quota_command) {
const char *p;
char *p2;
pstring syscmd;
char *syscmd = NULL;
int _id = -1;
switch(qtype) {
@ -206,13 +206,16 @@ static int command_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t
return -1;
}
slprintf(syscmd, sizeof(syscmd)-1,
"%s \"%s\" %d %d",
get_quota_command, path, qtype, _id);
if (asprintf(&syscmd, "%s \"%s\" %d %d",
get_quota_command, path, qtype, _id) < 0) {
return -1;
}
DEBUG (3, ("get_quota: Running command %s\n", syscmd));
lines = file_lines_pload(syscmd, NULL);
SAFE_FREE(syscmd);
if (lines) {
char *line = lines[0];
@ -325,7 +328,7 @@ static int command_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t
errno = ENOSYS;
return -1;
invalid_param:
file_lines_free(lines);
@ -336,11 +339,11 @@ invalid_param:
static int command_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp)
{
const char *set_quota_command;
set_quota_command = lp_set_quota_command();
if (set_quota_command && *set_quota_command) {
char **lines;
pstring syscmd;
char **lines = NULL;
char *syscmd = NULL;
int _id = -1;
switch(qtype) {
@ -357,37 +360,40 @@ static int command_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t
}
#ifdef LARGE_SMB_OFF_T
slprintf(syscmd, sizeof(syscmd)-1,
if (asprintf(&syscmd,
"%s \"%s\" %d %d "
"%u %llu %llu "
"%llu %llu %llu ",
"%llu %llu %llu ",
set_quota_command, path, qtype, _id, dp->qflags,
(long long unsigned)dp->softlimit,(long long unsigned)dp->hardlimit,
(long long unsigned)dp->isoftlimit,(long long unsigned)dp->ihardlimit,
(long long unsigned)dp->bsize);
(long long unsigned)dp->bsize) < 0) {
return -1;
}
#else /* LARGE_SMB_OFF_T */
slprintf(syscmd, sizeof(syscmd)-1,
if (asprintf(&syscmd,
"%s \"%s\" %d %d "
"%u %lu %lu "
"%lu %lu %lu ",
"%lu %lu %lu ",
set_quota_command, path, qtype, _id, dp->qflags,
(long unsigned)dp->softlimit,(long unsigned)dp->hardlimit,
(long unsigned)dp->isoftlimit,(long unsigned)dp->ihardlimit,
(long unsigned)dp->bsize);
(long unsigned)dp->bsize) < 0) {
return -1;
}
#endif /* LARGE_SMB_OFF_T */
DEBUG (3, ("get_quota: Running command %s\n", syscmd));
lines = file_lines_pload(syscmd, NULL);
SAFE_FREE(syscmd);
if (lines) {
char *line = lines[0];
DEBUG (3, ("Read output from set_quota, \"%s\"\n", line));
file_lines_free(lines);
return 0;
}
DEBUG (0, ("set_quota_command failed!\n"));