Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
bdd24508
...
bdd245085a05b9a6c67eea9e491c53bd96bf3287
authored
2007-02-27 16:12:03 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Get quota value from mu_auth_data, if available.
1 parent
89375988
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
14 deletions
mail.local/mailquota.c
mail.local/mailquota.c
View file @
bdd2450
...
...
@@ -23,13 +23,13 @@
#define DEFRETVAL MQUOTA_UNLIMITED
size
_t
groupquota
=
5
*
1024
*
1024UL
;
static
int
get_size
(
char
*
,
size
_t
*
,
char
**
);
mu_off
_t
groupquota
=
5
*
1024
*
1024UL
;
static
int
get_size
(
char
*
,
mu_off
_t
*
,
char
**
);
int
get_size
(
char
*
str
,
size
_t
*
size
,
char
**
endp
)
get_size
(
char
*
str
,
mu_off
_t
*
size
,
char
**
endp
)
{
size
_t
s
;
mu_off
_t
s
;
s
=
strtol
(
str
,
&
str
,
0
);
switch
(
*
str
)
...
...
@@ -60,7 +60,7 @@ get_size (char *str, size_t *size, char **endp)
#define RETR_FAILURE 1
int
fail_retrieve_quota
(
char
*
name
,
size
_t
*
quota
)
fail_retrieve_quota
(
char
*
name
,
mu_off
_t
*
quota
)
{
mu_error
(
_
(
"No quota retrieving mechanism"
));
return
RETR_FAILURE
;
...
...
@@ -68,7 +68,7 @@ fail_retrieve_quota (char *name, size_t *quota)
#ifdef USE_DBM
int
dbm_retrieve_quota
(
char
*
name
,
size
_t
*
quota
)
dbm_retrieve_quota
(
char
*
name
,
mu_off
_t
*
quota
)
{
DBM_FILE
db
;
DBM_DATUM
named
,
contentd
;
...
...
@@ -149,13 +149,13 @@ dbm_retrieve_quota (char *name, size_t *quota)
#include <auth/sql.h>
int
sql_retrieve_quota
(
char
*
name
,
size
_t
*
quota
)
sql_retrieve_quota
(
char
*
name
,
mu_off
_t
*
quota
)
{
mu_sql_connection_t
conn
;
char
*
query_str
;
int
rc
,
status
;
char
*
tmp
;
size
_t
n
;
mu_off
_t
n
;
query_str
=
mu_sql_expand_query
(
quota_query
,
name
);
if
(
!
query_str
)
...
...
@@ -253,21 +253,29 @@ sql_retrieve_quota (char *name, size_t *quota)
static
int
retrieve_quota
(
char
*
name
,
size
_t
*
quota
)
retrieve_quota
(
struct
mu_auth_data
*
auth
,
mu_off
_t
*
quota
)
{
if
(
MU_HAS_QUOTA
(
auth
))
{
if
(
auth
->
quota
==
0
)
return
RETR_UNLIMITED
;
*
quota
=
auth
->
quota
;
return
RETR_OK
;
}
#ifdef USE_SQL
if
(
quota_query
)
return
sql_retrieve_quota
(
name
,
quota
);
return
sql_retrieve_quota
(
auth
->
name
,
quota
);
#endif
return
default_retrieve_quota
(
name
,
quota
);
return
default_retrieve_quota
(
auth
->
name
,
quota
);
}
int
check_quota
(
char
*
name
,
size_t
size
,
size
_t
*
rest
)
check_quota
(
struct
mu_auth_data
*
auth
,
mu_off_t
size
,
mu_off
_t
*
rest
)
{
size
_t
quota
;
mu_off
_t
quota
;
switch
(
retrieve_quota
(
name
,
&
quota
))
switch
(
retrieve_quota
(
auth
,
&
quota
))
{
case
RETR_FAILURE
:
return
DEFRETVAL
;
...
...
Please
register
or
sign in
to post a comment