Bug 7775 - smb.conf(5) get quota command description mistakes
Summary: smb.conf(5) get quota command description mistakes
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.5
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.5.6
Hardware: All All
: P3 minor
Target Milestone: ---
Assignee: Volker Lendecke
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-03 10:31 UTC by TAKAHASHI Motonobu
Modified: 2012-09-07 22:43 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description TAKAHASHI Motonobu 2010-11-03 10:31:30 UTC
In smb.conf(5) for get quota command parameter, 

-----
    The type of query can be one of :
    o 1 - user quotas
    o 2 - user default quotas (uid = -1)
    o 3 - group quotas
    o 4 - group default quotas (gid = -1)
-----

This should be:

-----
    The type of query can be one of :
    o 1 - user default quotas (uid = -1)
    o 2 - user quotas
    o 3 - group default quotas (gid = -1)
    o 4 - group quotas
-----

Because in include/ntquotas.h, SMB_QUOTA_TYPE is defined as:

-----
enum SMB_QUOTA_TYPE {
        SMB_INVALID_QUOTA_TYPE = -1,
        SMB_USER_FS_QUOTA_TYPE = 1,
        SMB_USER_QUOTA_TYPE = 2,
        SMB_GROUP_FS_QUOTA_TYPE = 3,/* not used yet */
        SMB_GROUP_QUOTA_TYPE = 4 /* not in use yet, maybe for disk_free queries
*/
};
-----

 and smbcquotas command which has just used the definition above works well.
Comment 1 TAKAHASHI Motonobu 2010-11-03 10:56:41 UTC
In smb.conf(5) for get quota command parameter, 

-----
    This script should print one line as output with spaces between the
    arguments. The arguments are:

    o Arg 1 - quota flags (0 = no quotas, 1 = quotas enabled, 2 =
              quotas enabled and enforced)
-----

is invalid. In lib/sysquotas.c, 

-----
222 DEBUG (3, ("Read output from get_quota, \"%s\"\n", line));
223
224 /* we need to deal with long long unsigned here, if supported */
225
226 dp->qflags = (enum SMB_QUOTA_TYPE)strtoul(line,&p2, 10);
227 p = p2;
-----

this shows the 1st argument of "get quota command" should be one of SMB_QUOTA_TYPE, not "quota flags".
Comment 2 Björn Jacke 2012-09-05 13:54:46 UTC
(In reply to comment #0)
> In smb.conf(5) for get quota command parameter, 
> 
> -----
>     The type of query can be one of :
>     o 1 - user quotas
>     o 2 - user default quotas (uid = -1)
>     o 3 - group quotas
>     o 4 - group default quotas (gid = -1)
> -----
> 
> This should be:
> 
> -----
>     The type of query can be one of :
>     o 1 - user default quotas (uid = -1)
>     o 2 - user quotas
>     o 3 - group default quotas (gid = -1)
>     o 4 - group quotas
> -----
> 
> Because in include/ntquotas.h, SMB_QUOTA_TYPE is defined as:
> 
> -----
> enum SMB_QUOTA_TYPE {
>         SMB_INVALID_QUOTA_TYPE = -1,
>         SMB_USER_FS_QUOTA_TYPE = 1,
>         SMB_USER_QUOTA_TYPE = 2,
>         SMB_GROUP_FS_QUOTA_TYPE = 3,/* not used yet */
>         SMB_GROUP_QUOTA_TYPE = 4 /* not in use yet, maybe for disk_free queries
> */
> };
> -----
> 
>  and smbcquotas command which has just used the definition above works well.

I'm not sure about that. Metze that patch is initially from you says git, what do you think about the proposed fix ? :-)


> 226 dp->qflags = (enum SMB_QUOTA_TYPE)strtoul(line,&p2, 10);
> 227 p = p2;
> -----
> 
> this shows the 1st argument of "get quota command" should be one of
> SMB_QUOTA_TYPE, not "quota flags".

I think the enum cast is not quite right here, uint32 would fit better.
Comment 3 Björn Jacke 2012-09-07 22:43:13 UTC
the wrong cast is fixed with 4.0 and the docu is also improved now, so I close this one now, hope things are okay now,