Univention Bugzilla – Attachment 10933 Details for
Bug 54537
Filesystem quota doesn't work with usernames containing only numbers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
54537.patch
54537.patch (text/plain), 4.65 KB, created by
Arvid Requate
on 2022-03-28 14:55:21 CEST
(
hide
)
Description:
54537.patch
Filename:
MIME Type:
Creator:
Arvid Requate
Created:
2022-03-28 14:55:21 CEST
Size:
4.65 KB
patch
obsolete
>commit c9fb767998 >Author: Arvid Requate <requate@univention.de> >Date: Mon Mar 28 14:50:22 2022 +0200 > > Bug #54537: Make quota work for numeric only usernames > >diff --git a/base/univention-quota/files/univention-group-quota b/base/univention-quota/files/univention-group-quota >index b48e03e0bb..c834046239 100644 >--- a/base/univention-quota/files/univention-group-quota >+++ b/base/univention-quota/files/univention-group-quota >@@ -89,13 +89,13 @@ setQuotaForUserOnFilesystem () { # USER FILESYSTEM BSL BHL > local ISL=$(quota -wulv "$USER"|tr -s '\t' ' '|grep "^ *$FILESYSTEM "|cut -d' ' -f6) > local IHL=$(quota -wulv "$USER"|tr -s '\t' ' '|grep "^ *$FILESYSTEM "|cut -d' ' -f7) > verbose "Setting quota $BSL/$BHL ($ISL/$IHL) for $USER on $FILESYSTEM" >- setquota -u "$USER" "$BSL" "$BHL" "$ISL" "$IHL" "$FILESYSTEM" >+ setquota --always-resolve -u "$USER" "$BSL" "$BHL" "$ISL" "$IHL" "$FILESYSTEM" > } > > userHasQuotaOnFilesystem () { # USER FILESYSTEM > local USER="$1" > local FILESYSTEM="$2" >- quota -wul "$USER"|tr -s '\t' ' '|grep -qs "^ *$FILESYSTEM " >+ quota --always-resolve -wul "$USER"|tr -s '\t' ' '|grep -qs "^ *$FILESYSTEM " > } > > usage () { >diff --git a/base/univention-quota/files/univention-setquota b/base/univention-quota/files/univention-setquota >index 5b393ee40d..8ea51c4d32 100644 >--- a/base/univention-quota/files/univention-setquota >+++ b/base/univention-quota/files/univention-setquota >@@ -76,8 +76,8 @@ len=0 > #search for mountpoint > for mpoint in `cat /etc/mtab | awk '{print $2}'`; do if [ "`echo "$share" | sed -e "s|^$mpoint||"`" != "$share" -a $len -lt `echo $mpoint | wc -m` ]; then len=`echo $mpoint | wc -m`; filesystem=$mpoint; fi; done > >-echo "/usr/sbin/setquota $type $sid $blocksoft $blockhard $inodesoft $inodehard $filesystem" >> $LOGFILE >-if /usr/sbin/setquota $type $sid $blocksoft $blockhard $inodesoft $inodehard $filesystem >> /dev/null 2>&1 >+echo "/usr/sbin/setquota --always-resolve $type $sid $blocksoft $blockhard $inodesoft $inodehard $filesystem" >> $LOGFILE >+if /usr/sbin/setquota --always-resolve $type $sid $blocksoft $blockhard $inodesoft $inodehard $filesystem >> /dev/null 2>&1 > then > echo "univention-setquota: done" > else >diff --git a/base/univention-quota/files/univention-user-quota b/base/univention-quota/files/univention-user-quota >index 97c003015b..e7c6455717 100644 >--- a/base/univention-quota/files/univention-user-quota >+++ b/base/univention-quota/files/univention-user-quota >@@ -236,8 +236,8 @@ if __name__ == '__main__': > log.write('Found %i shares and %i mountpoints\n' % (len(shares), len(mountpoints))) > for mountpoint_path, attrs in mountpoints.iteritems(): > if attrs['reapplyQuota']: >- log.write('Set quota on mountpoint "%s": /usr/sbin/setquota -u %s %s %s %s %s %s\n' % (mountpoint_path, user, attrs['spaceSoftLimit'], attrs['spaceHardLimit'], attrs['inodeSoftLimit'], attrs['inodeHardLimit'], mountpoint_path)) >- command = ['/usr/sbin/setquota', '-u', user, str(attrs['spaceSoftLimit']), str(attrs['spaceHardLimit']), str(attrs['inodeSoftLimit']), str(attrs['inodeHardLimit']), mountpoint_path] >+ log.write('Set quota on mountpoint "%s": /usr/sbin/setquota --always-resolve -u %s %s %s %s %s %s\n' % (mountpoint_path, user, attrs['spaceSoftLimit'], attrs['spaceHardLimit'], attrs['inodeSoftLimit'], attrs['inodeHardLimit'], mountpoint_path)) >+ command = ['/usr/sbin/setquota', '--always-resolve', '-u', user, str(attrs['spaceSoftLimit']), str(attrs['spaceHardLimit']), str(attrs['inodeSoftLimit']), str(attrs['inodeHardLimit']), mountpoint_path] > set_quota = subprocess.Popen(command, stderr=log) > set_quota.wait() > else: >diff --git a/base/univention-quota/test/quotatest b/base/univention-quota/test/quotatest >index e907116adf..8dbad5e918 100755 >--- a/base/univention-quota/test/quotatest >+++ b/base/univention-quota/test/quotatest >@@ -208,7 +208,7 @@ _quota() { > case "$mtype" in > local) > if [[ "$qtype" == "local" ]]; then >- setquota -u "$user" "$soft" "$limit" 0 0 "$fs" >+ setquota --always-resolve -u "$user" "$soft" "$limit" 0 0 "$fs" > fi > __quota "$user" "$fs/$file" "$limit" > rc=$? >diff --git a/base/univention-quota/umc/python/quota/tools.py b/base/univention-quota/umc/python/quota/tools.py >index 75c5cd4f5d..fd17bbda9e 100644 >--- a/base/univention-quota/umc/python/quota/tools.py >+++ b/base/univention-quota/umc/python/quota/tools.py >@@ -117,7 +117,7 @@ def repquota_parse(partition, output): > > > def setquota(partition, user, bsoft, bhard, fsoft, fhard): >- cmd = ('/usr/sbin/setquota', '-u', user, str(bsoft), str(bhard), str(fsoft), str(fhard), partition) >+ cmd = ('/usr/sbin/setquota', '--always-resolve', '-u', user, str(bsoft), str(bhard), str(fsoft), str(fhard), partition) > return subprocess.call(cmd) > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 54537
:
10932
| 10933