projects
/
debian
/
amanda
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 3.3.1
[debian/amanda]
/
client-src
/
client_util.c
diff --git
a/client-src/client_util.c
b/client-src/client_util.c
index 89365ce44aab90e3a69c312f5615f227885396cb..513d9ba7402fcd180fd71d30ad5cc31b6906479b 100644
(file)
--- a/
client-src/client_util.c
+++ b/
client-src/client_util.c
@@
-1425,7
+1425,6
@@
run_calcsize(
FILE *dumpout = NULL;
int dumpsince;
char *errmsg = NULL;
FILE *dumpout = NULL;
int dumpsince;
char *errmsg = NULL;
- off_t size = (off_t)1;
char *line = NULL;
amwait_t wait_status;
int len;
char *line = NULL;
amwait_t wait_status;
int len;
@@
-1521,7
+1520,7
@@
run_calcsize(
match_expr = vstralloc(" %d SIZE %lld", NULL);
len = strlen(qdisk);
match_expr = vstralloc(" %d SIZE %lld", NULL);
len = strlen(qdisk);
- for(
size = (off_t)-1
; (line = agets(dumpout)) != NULL; free(line)) {
+ for(; (line = agets(dumpout)) != NULL; free(line)) {
long long size_ = (long long)0;
if (line[0] == '\0' || (int)strlen(line) <= len)
continue;
long long size_ = (long long)0;
if (line[0] == '\0' || (int)strlen(line) <= len)
continue;
@@
-1532,7
+1531,6
@@
run_calcsize(
dbprintf(_("estimate size for %s level %d: %lld KB\n"),
qdisk, level, size_);
}
dbprintf(_("estimate size for %s level %d: %lld KB\n"),
qdisk, level, size_);
}
- size = (off_t)size_;
}
amfree(match_expr);
}
amfree(match_expr);
@@
-1576,11
+1574,10
@@
common_exit:
amfree(errmsg);
g_ptr_array_free_full(argv_ptr);
amfree(cmd);
amfree(errmsg);
g_ptr_array_free_full(argv_ptr);
amfree(cmd);
-
}
}
-void
+gboolean
check_access(
char * filename,
int mode)
check_access(
char * filename,
int mode)
@@
-1597,14
+1594,18
@@
check_access(
else
noun = "access", adjective = "accessible";
else
noun = "access", adjective = "accessible";
- if(access(filename, mode) == -1)
+ if(access(filename, mode) == -1)
{
g_printf(_("ERROR [can not %s %s: %s]\n"), noun, quoted, strerror(errno));
g_printf(_("ERROR [can not %s %s: %s]\n"), noun, quoted, strerror(errno));
- else
+ amfree(quoted);
+ return FALSE;
+ } else {
g_printf(_("OK %s %s\n"), quoted, adjective);
g_printf(_("OK %s %s\n"), quoted, adjective);
+ }
amfree(quoted);
amfree(quoted);
+ return TRUE;
}
}
-void
+gboolean
check_file(
char * filename,
int mode)
check_file(
char * filename,
int mode)
@@
-1617,6
+1618,7
@@
check_file(
quoted = quote_string(filename);
g_printf(_("ERROR [%s is not a file]\n"), quoted);
amfree(quoted);
quoted = quote_string(filename);
g_printf(_("ERROR [%s is not a file]\n"), quoted);
amfree(quoted);
+ return FALSE;
}
} else {
int save_errno = errno;
}
} else {
int save_errno = errno;
@@
-1624,13
+1626,19
@@
check_file(
g_printf(_("ERROR [can not stat %s: %s]\n"), quoted,
strerror(save_errno));
amfree(quoted);
g_printf(_("ERROR [can not stat %s: %s]\n"), quoted,
strerror(save_errno));
amfree(quoted);
+ return FALSE;
}
if (getuid() == geteuid()) {
}
if (getuid() == geteuid()) {
- check_access(filename, mode);
+ return check_access(filename, mode);
+ } else {
+ quoted = quote_string(filename);
+ g_printf("OK %s\n", quoted);
+ amfree(quoted);
}
}
+ return TRUE;
}
}
-void
+gboolean
check_dir(
char * dirname,
int mode)
check_dir(
char * dirname,
int mode)
@@
-1644,6
+1652,7
@@
check_dir(
quoted = quote_string(dirname);
g_printf(_("ERROR [%s is not a directory]\n"), quoted);
amfree(quoted);
quoted = quote_string(dirname);
g_printf(_("ERROR [%s is not a directory]\n"), quoted);
amfree(quoted);
+ return FALSE;
}
} else {
int save_errno = errno;
}
} else {
int save_errno = errno;
@@
-1651,15
+1660,23
@@
check_dir(
g_printf(_("ERROR [can not stat %s: %s]\n"), quoted,
strerror(save_errno));
amfree(quoted);
g_printf(_("ERROR [can not stat %s: %s]\n"), quoted,
strerror(save_errno));
amfree(quoted);
+ return FALSE;
}
if (getuid() == geteuid()) {
}
if (getuid() == geteuid()) {
+ gboolean result;
dir = stralloc2(dirname, "/.");
dir = stralloc2(dirname, "/.");
- check_access(dir, mode);
+
result =
check_access(dir, mode);
amfree(dir);
amfree(dir);
+ return result;
+ } else {
+ quoted = quote_string(dirname);
+ g_printf("OK %s\n", quoted);
+ amfree(quoted);
}
}
+ return TRUE;
}
}
-void
+gboolean
check_suid(
char * filename)
{
check_suid(
char * filename)
{
@@
-1670,18
+1687,25
@@
check_suid(
if(!stat(filename, &stat_buf)) {
if(stat_buf.st_uid != 0 ) {
g_printf(_("ERROR [%s is not owned by root]\n"), quoted);
if(!stat(filename, &stat_buf)) {
if(stat_buf.st_uid != 0 ) {
g_printf(_("ERROR [%s is not owned by root]\n"), quoted);
+ amfree(quoted);
+ return FALSE;
}
if((stat_buf.st_mode & S_ISUID) != S_ISUID) {
g_printf(_("ERROR [%s is not SUID root]\n"), quoted);
}
if((stat_buf.st_mode & S_ISUID) != S_ISUID) {
g_printf(_("ERROR [%s is not SUID root]\n"), quoted);
+ amfree(quoted);
+ return FALSE;
}
}
else {
g_printf(_("ERROR [can not stat %s: %s]\n"), quoted, strerror(errno));
}
}
else {
g_printf(_("ERROR [can not stat %s: %s]\n"), quoted, strerror(errno));
+ amfree(quoted);
+ return FALSE;
}
amfree(quoted);
#else
(void)filename; /* Quiet unused parameter warning */
#endif
}
amfree(quoted);
#else
(void)filename; /* Quiet unused parameter warning */
#endif
+ return TRUE;
}
/*
}
/*