diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-fs/quota |
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-fs/quota')
23 files changed, 1264 insertions, 0 deletions
diff --git a/sys-fs/quota/Manifest b/sys-fs/quota/Manifest new file mode 100644 index 000000000000..84813bc1c937 --- /dev/null +++ b/sys-fs/quota/Manifest @@ -0,0 +1,26 @@ +AUX ldap-scripts/applySystemQuotas.pl 3229 SHA256 dc297aea060370c633dd24a0bb507e0573b30af2c311b6123040f2322398ac59 SHA512 d7565f05cf8fe4b8aea37c4eecbccdf1acc4a0d3e8b11f88a6daf8cbc9c466a8ec2cbaeac67e6aca6bdae49056b4eb639aef2759b7507d9896bc57526109e6c1 WHIRLPOOL 2e5b6c84cd3c843d23524ad7d1d1f919cd4c8176e7e46d6f2a7df4a127e4f8ca088050784cdf34fd6bafbe09a5e750710b0dc2b60be45f906fd3320b55a33b13 +AUX ldap-scripts/edquota_editor 1243 SHA256 b41f25fcdce2286751652cd4f8c68092fd16e0c2b48703a18f00eb4e84d6b7e3 SHA512 ea3750614ddf6ab1ab1f488ba946e052ddaa760b3ec86ddb954a86fd959ae7264b75941b3fd130c64923dfe535ac288c5ec5ddc50149c8197e2a1bbeba70caf6 WHIRLPOOL 0d2ede128f7ca8eecf166359890735a43bed8b988e2047cdb13232f10109f08b6f555531e926733d8d4e9a94cb4b902702d37ca97cedd328a976d20980a04eb3 +AUX ldap-scripts/quota.schema 552 SHA256 3dbfb0edead44b8c86d756f96c7a191deb9a4a2d7c82e2014cc0779834670d38 SHA512 9e08e51834458885a046395002bb19a463533bc0e1fc23f1fda98c41ee48c0f122e284f4a520d6f6ef44d66142395c10f91e18076e0a54e57dd198f7da268748 WHIRLPOOL abf94dea7ee99c8867e6e5d179974c35fc42313a79fd9e3b5a2b31cce0436c3231281619207128a52515cdafd4d94aa84437feb01ca8245a95c4ac7d645bf2c0 +AUX ldap-scripts/setSystemQuotas.pl 3930 SHA256 b068f5b3df52b43065d202bbdb75ebba17e9154d42005a524b0488a54b36251e SHA512 8ecdd09500a849c4572411e904dc78ff967ed71f819969e0a27e697ca6607ca17906318784ccf1aca4fe066666dd2a21d800ce6f224478d0751db1a5c276a6ad WHIRLPOOL 3a75910a638ecd4be5e2501bf7ef44c2e94dc13e6e5660cbf44a8f1c4460d0732117360fc84c38f9b3d031f0363403a2571fbac788a3252ac30edc5318acdba5 +AUX ldap-scripts/setquota-ldap.pl 6039 SHA256 8f212d619badd83b3566378ba3b64099b28eb2c160f1b3539a59cdcca18114dd SHA512 f046c45b09b8afa88d11b4d55e35877c1c7e6c8e87f41f4c2dfcb063a2bd972cf584f88fdea2b42442cb44e460a48f3c9b12c3f5f3a99f759bbdb4ca95ab8e5b WHIRLPOOL 1a1a8578cc2e8396ecf4157d756c9160a782c41ca8b0789c7c2571244c4cee76cb6d054409500b3dfcc23d87e71ccdb6050a463b72adb83a4e730f6eaa241813 +AUX quota-4.03-default_fpic_fpie.patch 1065 SHA256 af14f06681c443024f702f824614b945093a5eb92479aeb7ff64a66ceb9dbc7e SHA512 0d62dcf9261a768b471a2f3f9f1e191911a4579f920521739d8bcc70fc8e51e8dbafcd9e8798f0e894b19acaa0bfd7c5a378ee392c64ba8c91f4dc7940774862 WHIRLPOOL d3234004fbfffb1777b8688c2cfbf79d65066368799f161465854e7d65c83bf79b2e837de15fe0cb7915f7b5f78602e883e3ec3a7c743b2c9b6fad2c6b814325 +AUX quota-4.03-distribute_ldap-scripts.patch 547 SHA256 d2c720b92b8aeb58332688e30d0603efd837f8e64562361fd78fce9cecd05fe7 SHA512 0ac9aecf4749a74af0ae17b045463c7afe8cd46ca3b395ccd1bc46112eb793c593ba875fdd9882e4afb8e3962c0e8dc7a9a9872edd99f52d31bcc159b22ddb2a WHIRLPOOL f32173df16bfbf341d60de5dd679ce1351d01028e8e1d4d605726b46037475f990d54c2285e7e318496987a6e564577ae89e87da5249fad98d332a07647e15ab +AUX quota-4.03-dont_override_cflags.patch 838 SHA256 bed50d591f574450eaa36317e86f6dece1a981978e12641f934b13ed78759e91 SHA512 64e7dbd966e8e5cf2938367542a292e5538526e01950241fd9d98f378a364acb0fd16928e35151cfdfabe4ac7e3c971def44f7ab085c441c77c3124bbf93603e WHIRLPOOL ef9f546a17ba6b13c7a7aae6cc33cb3fbc6e711ee5527fdbf7a58fa265afd43ac76232b848cad23dcd1fa53421c9409210fcc9269a40fde5fea602a6007a7970 +AUX quota-4.03-explicitely_print_disabled_options.patch 2210 SHA256 32cf85671c5c044efbee871cca2305a10c3b07ff7d272c6e2a7c574bac3da9dc SHA512 9e3080c47ef46a3d4d16c266ec739091d0278c4c9cbda61337c55db1461b97129045c65f51d9d72a5855040cb67942cdf10f728865ded04fb3d865dd36695018 WHIRLPOOL 39075a4ee1f6b0eaa3384a2b91aceb509f975cec7c129f9a8c22cac151fe4ac4570de08f12c0cdbf51e4d362b24104fe75dcaf5e9e0432b2306d2c5c904cd0e2 +AUX quota-4.03-fix_build_without_ldap.patch 2731 SHA256 dcec0a7e7c02f7cfc3ef50354c7a961e1a7e4f07743b9b50585da46df9b00afb SHA512 f43b0701e3545a70f248a749dd99f1da1ecfd317e9ba4333b1496f5a3086bd89b12f31207946c36a872ab98034ae7260b3e403ddffb38a6e2f2128ee86fbc0d0 WHIRLPOOL 20aa9f6f77211bdbf0ea56439290e2f53192f5ed62bfcef5c884cbfa0f03b57f571e185d6fbac001e45024342b69defbea40621ee7e2d0d65188f0dc59d55f17 +AUX quota-4.03-no_rpc.patch 2338 SHA256 9bb9cf75a7cba8cf2366d5dd4bba263085acfe18409814357baa86902bb731fb SHA512 3569d31e2bee3e817a48f579153367bf4306b2df2c074df7928e95cb80533d493b48651fe3498f66982c5918e97db8a89ceb669e25e0010eb77e87a648552353 WHIRLPOOL 57fb034a59cf76d8e5638d0dc3d9b02669202d345f21d5171aaac2d1300b54cc764ea4dee8c8eb41d8258c8eabc702e7cb387fdb001d56fa149dcfd5b217d0a5 +AUX quota-4.03-noldap_linking.patch 2714 SHA256 80140cf194f390b453dd7c12c0d8cd3eea48d55dc27672bc71130c302f120fff SHA512 93617ac00731e9a1e29807c386fb86d5a7c3c646698f7d4faa7837fe363d08a31c96ccb37564b210f8d15e9f331dc6495feac189b2f834c3aff85c0e6e811735 WHIRLPOOL 7463bd9c2e1f4288c75e0973cb389e915a2b8f08455dd121a108a82bee4f4f91f64aef71a26f3091674239c81386bce5f541cfec2a54c4d9c06af687473f84ef +AUX quota-4.03-repqouta_F_option_arg.patch 947 SHA256 99496ec9aab5e7d098b398c5a0f230594b0ffe79a49d0a6f6b89aac604d9a8c5 SHA512 14bf1dd782861640c4beef0621166006c083266ca0dccfa51d0ee889553b809c6652de82e75710ac961eef3e6fb47d2c528b7111bdefabcbac7967951ec62ac9 WHIRLPOOL 614d2863d08d0612f4264f29c95d4ca82bc400616e57ad2234a6a4a76164a4c99229367c630d8911d5e7a093765bb2772019a2732702ce55ceec772aad4e8bdf +AUX quota-4.03-respect_docdir.patch 586 SHA256 fb1998bc171e9ad42ad4472cb6c8288f2f3dc01918a6b5778a97a6f081ae510a SHA512 16feff00e236ac6b652b095fe84fa2fa357c849a85124c92ec32c9a22ae487b2a6f49ea4118f0a665cad27756aeec7e775a42014d2e2408ecefcacb1d60231de WHIRLPOOL afe429b90cdf2a0a52b7f3a62917c918b3ac9088ce4522b2b4cebbd6e4efd8755b8f5897dda1c19ea8c37e57e6c854d8d25ab4d6a19d8ca59030d69b6c90de8d +AUX quota-4.04-glibc226.patch 983 SHA256 95e65628b600939e1ac4f59986e05fd05e56b0b64b03910364be8ddc5df8d154 SHA512 90bcfb9fbb881602cb01000cea691016e6c7c99a5d2fc22b114615fec9ef4752c07253eaeaf80023e6f0768ab95429aac10772f6d12547c43eba4300877f89b9 WHIRLPOOL 250b2802e8891fe46be73517dc789f67457396059f526acd11caad94648e54430c7dfc581fc2ffd36495b016643e48c83729d905ed9d46303e3a440640149704 +AUX quota.confd 359 SHA256 00d1dfb3b893db5d6a213a4edda622c7d64dcafa40b3019f15e070c164286632 SHA512 3253b69932332eff2944753f687d780d651dc2b21b524b7055164b91292c13c346cd46443bd58267b239f72fd8918a7e113eec62871573ee94e33df5eb3c82f8 WHIRLPOOL d7346be0e63e2cb2901d519846969cab4567efd5f47725abc083b6995e65e2a38c56c8a74a50ce1ec72d627997da9dcf1cda343bf6874112d31f6b4428781db9 +AUX quota.rc7 688 SHA256 2a4dc1f695a881d0715e6220dad54b3690d98bf26b618b0fe6cb4ab26823e047 SHA512 6a0536285bb340779cf4989060ed5a10c9c4a24a48d334174cd84cd54938d042f7a4047f837f96fc7a3c88a1d20317f662c984bd88c00b32cbf48302ba82a529 WHIRLPOOL 1e1736857a08090eaf865b2a389b2653fc2651a9e83e2fad3ffa02b79bfe26f7fccf9dac4fa433a5d055808beba82d063aa94acc8f32ea7f1e008aa4fe9429f4 +AUX rpc.rquotad.initd 448 SHA256 ef7eec0fd1921f786580169628c9cc7af82c73d0b2cf420fba0e87f8fd428651 SHA512 c6ab8d6e0e15032bbbee523c2550e7f23d48fb45035d37181e988f2f96cd1ece316681f1b529b51fd1aeb390c5f27a6911f5de52132e90b4cbcfb4c2dfc95954 WHIRLPOOL 09938090009109af7d427982c960866da3e83fa187154d8471a53d253f4faa600152598f90ec8bcaad5ae1af8c2cbf80176363e2c5361c6aec16435f7d9f7843 +DIST quota-4.03.tar.gz 564352 SHA256 9c6c4d9ae7bf30506dd2aa3d8056c4ff2f8d087930d7c721616f5c093bdc674b SHA512 9603940048dcc0c4db6d6e14173769c815641ebc78a0cc457a0622dbfc597319bae1eaad4ef3281c52757995d47424b96dc66426ce540a8b538b996eea2dc5f8 WHIRLPOOL 4a6354f7732e6c60782dbfb60fbfae47c96c438315572dccaf7d2563b8dab5eb46072f999481abe237df8dafaf252b095c9bcd5d58beecdf75db6aca8d46f4ab +DIST quota-4.04.tar.gz 577303 SHA256 735be1887e7f51f54165e778ae43fc859c04e44d88834ecb2f470e91d4ef8edf SHA512 adc33863d2a966b4c46983fa3926e6b6ba75e260ed21bdff646584237840e6beb0dcfbfd2f655969aa5675c3c398ac2e483afb933f03f983756ebb3352d0eaad WHIRLPOOL ac6466fffaa0954b13a812827bba4f8753640b80fefb6cbbd582a3c916cc7b302e865ddfb3919335a2fe23168bf5894032a7393b4f1ef4615b75f30adc501f3e +EBUILD quota-4.03.ebuild 1960 SHA256 ea6afebc7b0b73ac4c67372c50f7eee7484ff72e8d8f8958e3e455aaabf9ae08 SHA512 fd2a5affaecc2046a5517b4e96ac46f190c6505f0166cfd52046308cb69846ee154b5c3f7a18f6d70b2507d0253c69b569a255afc91b630f59fa694dd9a81f6f WHIRLPOOL 14498b3b6f403db792891e45593da024e0d275bea49acdf00ec66d20e5d785f88afa576b7eaeaff50544d623e0dd232d9a0bd8c605604f8983f43678079722b9 +EBUILD quota-4.04-r1.ebuild 1581 SHA256 838c258267511181f46df7da50939e52dd97b45496658b95794cc80d5a658ed0 SHA512 6e3249ea0b5fe951708f57dde5c3f8bd1345d62965bcb310b94a5aade3b3509a403008ed83182c18a57214462a81dfd7a9b10006f502ad25c2accd9c45271064 WHIRLPOOL 0063aee28bab3d58bf7ac3fa9b523281cc38754f92c3da13b154aea7fd821360fa6bc25e68bf8f5620d50f7d34b4f35eb98859332daa2a8005459a0c0331f866 +EBUILD quota-4.04.ebuild 1533 SHA256 42ac526669924f2100eb66334bb93d659d36aa29d06c167e1fa5b8aab0d0f702 SHA512 8c19891cac8d58458688541553bb60824324044106fcef0d842ff1c60b739bf36d9affc770617e33ff0e573d98cd2ee0ca09a9ec52a1640398a7a103ae411f67 WHIRLPOOL 19073fbfbe4e8fd87b3bb1f1ba5235aa7dc35a82d0277e58eb168a1629aadf1120abb204f3abe08ce5b828d2aad776def30803c84b2945d63cbdd6ff1dee8de0 +MISC ChangeLog 5012 SHA256 f9b564d481f5ca338cb368e1c6438ded908af53babe2ac0bbae34c5b1c47830a SHA512 e351b146d0415098bb55745b3849355f011594f16b196f2848116051c1f26b1b84896643f7f617cb40b79da5f16b97cdc35330e5eb828b728d9118eb6c9e0d0b WHIRLPOOL 41fa66d3798eb09b228ffa38f52d3468e3a1c56a03b47e4799bccc1b0e4dd3b3208b9d8196a12197e8b43d9f55176f777a57e0073429f9d56b02d531412f687c +MISC ChangeLog-2015 13798 SHA256 23bceb235276c26d40d568923540b29bebd6cc295861477cc7e31fd9e1fc1583 SHA512 a19963fc3710db18ed6ea7928f069d87cd2893120e7e89851d1333f28e05c3a7326277dd6697a4aa598414c59d308aa4732efb488f746276da6b481a30678be9 WHIRLPOOL d2501d19633f314b9deb14ca03d2cdf66f70dfbd50196430abd53de58ccb228f7b929d7aa589fbf08b861a2b9d8b012a8e8c3930cf8ac743baa7d99bfcd22289 +MISC metadata.xml 482 SHA256 020bd47324be182e87b05a97219e69a9bde9d191433fe4d16c1796068e099374 SHA512 50b2143425f8ab315784fab4d9e569d2f80893c91ba64b4c209947eb79688ed9e8e23955b9f04406d699de6f28e9c10dad78889853d05f84191af65911d7a38e WHIRLPOOL dd6fbd1c604f87b4d8d13644eab114946fd740ceff45d9eb101157dcb55b6788b5053d7c8b9ca89c655fbc12bd5fcbfd5c3bde954810d71e8987258cf284273e diff --git a/sys-fs/quota/files/ldap-scripts/applySystemQuotas.pl b/sys-fs/quota/files/ldap-scripts/applySystemQuotas.pl new file mode 100755 index 000000000000..41c74d919d37 --- /dev/null +++ b/sys-fs/quota/files/ldap-scripts/applySystemQuotas.pl @@ -0,0 +1,104 @@ +#!/usr/bin/perl -w + +# $0 -b "ou=People,dc=borgia,dc=com" -F '(attr=value)' + +# Synopsis +# applyQuotas.pl is a script solely for making the quota set within LDAP take +# affect by running the linuxquota tool edquota with the figures set in LDAP. +# This tool is capable of applying standard LDAP filters to the user-supplied +# base DN for applying multiple users' quotas at once. + +# Examples: +# Apply the quotas using the linuxquota tool edquota for user stefan +# ./applySystemQuotas.pl -b "uid=stefan,ou=People,dc=borgia,dc=com" +# +# Apply the quotas using the linuxquota tool edquota for all People with description of Student +# ./applySystemQuotas.pl -b "ou=People,dc=borgia,dc=com" -F "(description=Student)" + +use strict; +use Net::LDAP; +use Getopt::Long; + +chomp(my $Password = `cat /etc/ldap.secret`); +my $Host = 'localhost'; +my $Port = '389'; +my $BindDN = 'cn=Manager,dc=borgia,dc=com'; +my $SSL = 0; +my $edquota_editor = '/usr/sbin/edquota_editor'; +my $edquota = '/usr/sbin/edquota'; + +my $b = ''; +my $F = ''; +GetOptions( + 'b=s' => \$b, + 'F=s' => \$F, +); + +die "Usage: $0 -b basedn [-F '(extrafilter)']\n" unless $b; + +my $ldap = connectLDAP(); + +my $search; +$search = $ldap->search( + base => $b, + filter => "(&(objectClass=systemQuotas)$F)", + attrs => ['uid', 'quota'], +); +$search->code && die $search->error; +my $i = 0; +my $max = $search->count; +for ( $i=0; $i<$max; $i++ ) { + my $entry = $search->entry($i); + my $editor = $ENV{'VISUAL'} if $ENV{'VISUAL'}; + $ENV{'VISUAL'} = $edquota_editor; + $ENV{'QUOTA_USER'} = $entry->get_value('uid'); + # Delete all existing quotas for QUOTA_USER + $ENV{'QUOTA_FILESYS'} = '*'; + $ENV{'QUOTA_SBLOCKS'} = 0; + $ENV{'QUOTA_HBLOCKS'} = 0; + $ENV{'QUOTA_SFILES'} = 0; + $ENV{'QUOTA_HFILES'} = 0; + print "$ENV{'QUOTA_USER'}: $ENV{'QUOTA_FILESYS'}:$ENV{'QUOTA_SBLOCKS'},$ENV{'QUOTA_HBLOCKS'},$ENV{'QUOTA_SFILES'},$ENV{'QUOTA_HFILES'}\n"; + qx(/usr/sbin/edquota -u $ENV{'QUOTA_USER'}); + my @quotas = $entry->get_value('quota'); + if ( $#quotas >= 0 ) { + foreach ( @quotas ) { + my @quota = split /:/; + $ENV{'QUOTA_FILESYS'} = $quota[0]; + $ENV{'QUOTA_SBLOCKS'} = $quota[1]; + $ENV{'QUOTA_HBLOCKS'} = $quota[2]; + $ENV{'QUOTA_SFILES'} = $quota[3]; + $ENV{'QUOTA_HFILES'} = $quota[4]; + print "$ENV{'QUOTA_USER'}: $ENV{'QUOTA_FILESYS'}:$ENV{'QUOTA_SBLOCKS'},$ENV{'QUOTA_HBLOCKS'},$ENV{'QUOTA_SFILES'},$ENV{'QUOTA_HFILES'}\n"; + qx($edquota -u $ENV{'QUOTA_USER'}); + } + } + if ($editor) { + $ENV{'VISUAL'} = $editor; + } + else { + delete $ENV{'VISUAL'}; + } +} +$search = $ldap->unbind; + +sub connectLDAP { + # bind to a directory with dn and password + my $ldap = Net::LDAP->new( + $Host, + port => $Port, + version => 3, +# debug => 0xffff, + ) or die "Can't contact LDAP server ($@)\n"; + if ( $SSL ) { + $ldap->start_tls( + # verify => 'require', + # clientcert => 'mycert.pem', + # clientkey => 'mykey.pem', + # decryptkey => sub { 'secret'; }, + # capath => '/usr/local/cacerts/' + ); + } + $ldap->bind($BindDN, password=>$Password); + return $ldap; +} diff --git a/sys-fs/quota/files/ldap-scripts/edquota_editor b/sys-fs/quota/files/ldap-scripts/edquota_editor new file mode 100755 index 000000000000..fdebd09e35a4 --- /dev/null +++ b/sys-fs/quota/files/ldap-scripts/edquota_editor @@ -0,0 +1,32 @@ +#!/usr/bin/perl -w + +use strict; + +die "QUOTA_USER environment variable not set\n" unless defined $ENV{'QUOTA_USER'}; +die "QUOTA_FILESYS environment variable not set\n" unless defined $ENV{'QUOTA_FILESYS'}; +die "QUOTA_SBLOCKS environment variable not set\n" unless defined $ENV{'QUOTA_SBLOCKS'}; +die "QUOTA_HBLOCKS environment variable not set\n" unless defined $ENV{'QUOTA_HBLOCKS'}; +die "QUOTA_SFILES environment variable not set\n" unless defined $ENV{'QUOTA_SFILES'}; +die "QUOTA_HFILES environment variable not set\n" unless defined $ENV{'QUOTA_HFILES'}; + +open FILE, $ARGV[0]; +my $qdata = join '', (@_=<FILE>); +close FILE; +open FILE, ">$ARGV[0]"; +print FILE &edit_quota_file($qdata, $ENV{'QUOTA_FILESYS'}, $ENV{'QUOTA_SBLOCKS'}, $ENV{'QUOTA_HBLOCKS'}, $ENV{'QUOTA_SFILES'}, $ENV{'QUOTA_HFILES'}); +close FILE; + +# edit_quota_file(data, filesys, sblocks, hblocks, sfiles, hfiles) +sub edit_quota_file { + my($rv, $line, @line, $i); + @line = split /\n/, $_[0]; + for ( $i=0; $i<@line; $i++ ) { + if ($line[$i] =~ /^\s+(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/ && ($1 eq $_[1] || $_[1] eq '*')) { + # new-style line to change + $rv .= " $1 $2 $_[2] $_[3] $5 $_[4] $_[5]\n"; + } else { + $rv .= "$line[$i]\n"; + } + } + return $rv; +} diff --git a/sys-fs/quota/files/ldap-scripts/quota.schema b/sys-fs/quota/files/ldap-scripts/quota.schema new file mode 100644 index 000000000000..b5e216f8db96 --- /dev/null +++ b/sys-fs/quota/files/ldap-scripts/quota.schema @@ -0,0 +1,18 @@ +## +## schema file for Unix Quotas +## Schema for storing Unix Quotas in LDAP +## OIDs are owned by Cogent Innovators, LLC +## +## 1.3.6.1.4.1.19937.1.1.x - attributetypes +## 1.3.6.1.4.1.19937.1.2.x - objectclasses +## + +attributetype ( 1.3.6.1.4.1.19937.1.1.1 NAME 'quota' + DESC 'Quotas (FileSystem:BlocksSoft,BlocksHard,InodesSoft,InodesHard)' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255} ) + +objectclass ( 1.3.6.1.4.1.19937.1.2.1 NAME 'systemQuotas' SUP posixAccount AUXILIARY + DESC 'System Quotas' + MUST ( uid ) + MAY ( quota )) diff --git a/sys-fs/quota/files/ldap-scripts/setSystemQuotas.pl b/sys-fs/quota/files/ldap-scripts/setSystemQuotas.pl new file mode 100755 index 000000000000..90ab1e8076c9 --- /dev/null +++ b/sys-fs/quota/files/ldap-scripts/setSystemQuotas.pl @@ -0,0 +1,140 @@ +#!/usr/bin/perl -w + +# $0 -b "ou=People,dc=borgia,dc=com" -Q /dev/with/quota=0:0:0:0 -F '(attr=value)' + +# Synopsis +# setSystemQuotas.pl is a script solely for modifying the quota attribute in +# LDAP. It expects that the users you intend to have quotas already have the +# systemQuotas objectClass set. +# This tool is capable of applying standard LDAP filters to the user-supplied +# base DN for modifying multiple users' quotas at once. + +# Examples: +# Set quota on /dev/sda7 and /dev/sda8 for user stefan +# ./setSystemQuotas.pl -b "uid=stefan,ou=People,dc=borgia,dc=com" -Q /dev/sda7=4000000:4400000:10000:11000 -Q /dev/sda8=4000000:4400000:10000:11000 +# +# Set quota on /dev/sda8 for user all People with description of Student +# ./setSystemQuotas.pl -b "ou=People,dc=borgia,dc=com" -Q /dev/sda8=40000:44000:1000:1100 -F "(description=Student)" +# +# Delete quotas for user stefan +# ./setSystemQuotas.pl -b "uid=stefan,ou=People,dc=borgia,dc=com" + +use strict; +use Net::LDAP; +use Getopt::Long; + +chomp(my $Password = `cat /etc/ldap.secret`); +my $Host = 'localhost'; +my $Port = '389'; +my $BindDN = 'cn=Manager,dc=borgia,dc=com'; +my $SSL = 0; + +my $b = ''; +my %Q = (); +my $F = ''; +GetOptions( + 'b=s' => \$b, + 'Q=s' => \%Q, + 'F=s' => \$F, +); +die "Usage: $0 -b userdn [-F '(extrafilter)'] [-Q /fs=sb:hb:sf:hf ...]\n" unless $b; +foreach ( keys %Q ) { + local @_ = split /:/, $Q{$_}; + unless ( $#_ == 3 ) { + print "Ignoring $_: invalid format\n"; + delete $Q{$_}; + } +} + +my $ldap = connectLDAP(); + +my $quota = {}; +my $search; +$search = $ldap->search( + base => $b, + filter => "(&(objectClass=systemQuotas)$F)", + attrs => ['*', 'quota'], +); +$search->code && die $search->error; +my $i = 0; +my $max = $search->count; +for ( $i=0; $i<$max; $i++ ) { + my $entry = $search->entry($i); + my $dn = $entry->dn; + if ( keys %Q ) { + $quota->{$dn} = 1; + foreach ( $entry->get_value('quota') ) { + my @quota = split /:/; + my $fs = shift @quota; + delete $quota->{$dn} if $quota->{$dn} == 1; + $quota->{$dn}->{$fs} = join ':', @quota; + } + } else { + $quota->{$dn} = 0; + delete $quota->{$dn} unless $entry->get_value('quota'); + } +} + +foreach my $dn ( keys %{$quota} ) { + if ( ref $quota->{$dn} eq 'HASH' ) { +print STDERR "Modify $dn:\n"; + foreach ( keys %Q ) { +print STDERR "\t$_:$Q{$_}\n"; + $quota->{$dn}->{$_} = $Q{$_}; + } + my @quota = map { "$_:$quota->{$dn}->{$_}" } keys %{$quota->{$dn}}; + my $modify = $ldap->modify( + $dn, + replace => { + quota => [@quota], + }, + ); + $modify->code && warn "Failed to modify quota: ", $modify->error, "\n"; + } else { + if ( $quota->{$dn} == 1 ) { + delete $quota->{$dn}; +print STDERR "Add $dn:\n"; + foreach ( keys %Q ) { +print STDERR "\t$_:$Q{$_}\n"; + $quota->{$dn}->{$_} = $Q{$_} + } + my @quota = map { "$_:$quota->{$dn}->{$_}" } keys %{$quota->{$dn}}; + my $modify = $ldap->modify( + $dn, + add => { + quota => [@quota], + }, + ); + $modify->code && warn "Failed to modify quota: ", $modify->error, "\n"; + } elsif ( $quota->{$dn} == 0 ) { +print STDERR "Delete $dn:\n"; + my $modify = $ldap->modify( + $dn, + delete => ['quota'], + ); + $modify->code && warn "Failed to modify quota: ", $modify->error, "\n"; + } + } +} +$ldap->unbind; + +sub connectLDAP { + # bind to a directory with dn and password + my $ldap = Net::LDAP->new( + $Host, + port => $Port, + version => 3, +# debug => 0xffff, + ) or die "Can't contact LDAP server ($@)\n"; + if ( $SSL ) { + $ldap->start_tls( + # verify => 'require', + # clientcert => 'mycert.pem', + # clientkey => 'mykey.pem', + # decryptkey => sub { 'secret'; }, + # capath => '/usr/local/cacerts/' + ); + } + $ldap->bind($BindDN, password=>$Password); + return $ldap; +} diff --git a/sys-fs/quota/files/ldap-scripts/setquota-ldap.pl b/sys-fs/quota/files/ldap-scripts/setquota-ldap.pl new file mode 100644 index 000000000000..7cafc449d824 --- /dev/null +++ b/sys-fs/quota/files/ldap-scripts/setquota-ldap.pl @@ -0,0 +1,148 @@ +#!/usr/bin/perl + +# A Perl wrapper for setquota utility which updates LDAP accordingly. + +# /etc/fstab: usrquota,grpquota +# mount -o remount /f/s +# touch /f/s/aquota.{user,group} +# chmod 600 /f/s/aquota.{user,group} +# quotacheck -cguvamf + +use strict; +use warnings; +use Net::LDAP; +use Net::LDAP::Entry; +use Getopt::Long; +Getopt::Long::Configure ("bundling"); + +my $help = $#ARGV >= 0 ? 0 : 1; +my $ldaphost = 'localhost'; +my $passwordfile = ''; +my $password = ''; +my $binddn = $ENV{BINDDN}; +my $basedn = $ENV{BASEDN}; +my $oc = 'systemQuotas'; +my $attr = 'quota'; +my %Q = (); +my $F = 'cn=*'; +GetOptions( + 'help|?' => \$help, + 'oc|o=s' => \$oc, + 'attr|a=s' => \$attr, + 'quota|Q=s' => \%Q, + 'filter|F=s' => \$F, + 'ldaphost|h=s' => \$ldaphost, + 'basedn|b=s' => \$basedn, + 'binddn|D=s' => \$binddn, + 'password|w=s' => \$password, + 'passwordfile|W=s' => \$passwordfile, +); +die "Usage: $0 -b basedn [-o objectClass] [-a attr] [-F '(extrafilter)'] [-Q +/f/s=sb:hb:gb:sf:hf:gf ...]\n" if $help; +%Q = checkQ(%Q); + +my ($ldap, $bind); +if ( $ldap = Net::LDAP->new($ldaphost, version => 3, timeout => 3) ) { + if ( $binddn && $password ) { + $bind = $ldap->bind($binddn, password=>$password); + } elsif ( $binddn && $passwordfile ){ + $bind = $ldap->bind($binddn, password=>bindpw($passwordfile)); + } else { + $bind = $ldap->bind(); + } + die "Unable to connect to LDAP\n" if $bind->code; + undef $passwordfile; +} else { + die "Unable to connect to LDAP\n"; +} + +my $search = $ARGV[0] ? $ldap->search(base=>$basedn, filter=>"uid=$ARGV[0]") : $ldap->search(base=>$basedn, filter=>$F); +if ( $search->code ) { + die "LDAP Error: ", error($search), "\n"; +} elsif ( $search->count <= 0 ) { + die "0 results found in LDAP\n"; +} else { + my $i = 0; + for ( $i=0; $i<$search->count; $i++ ) { + my $entry = $search->entry($i); + my @oc = $entry->get_value('objectClass'); + # objectClass: $oc + unless ( grep { /^$oc$/ } @oc ) { + my $modify = $ldap->modify($entry->dn, add => {objectClass => $oc}); + if ( $modify->code ) { + print STDERR "Failed to add objectClass $oc:", error($modify), "\n"; + } + } + # $attr: /f/s=sb:hb:sf:hf + if ( $entry->exists($attr) ) { + my @attr = $entry->get_value($attr); + if ( keys %Q ) { + foreach my $fs ( keys %Q ) { + foreach ( @attr ) { + next unless /^$fs=/; + my $modify = $ldap->modify($entry->dn, delete => {$attr => "$_"}); + if ( $modify->code ) { + print STDERR "Failed to delete $attr: $_: ", error($modify), "\n"; + } + } + my $modify = $ldap->modify($entry->dn, add => {$attr => "$fs=$Q{$fs}"}); + if ( $modify->code ) { + print STDERR "Failed to add $attr: $fs=$Q{$fs}: ", error($modify), "\n"; + } else { + print STDERR "Failed to setquota: $fs=$Q{$fs}\n" if setquota($entry->get_value('uid'), $fs, $Q{$fs}); + } + } + } else { + my $modify = $ldap->modify($entry->dn, delete => [($attr)]); + if ( $modify->code ) { + print STDERR "Failed to delete $attr: ", error($modify), "\n"; + } else { + foreach ( @attr ) { + my ($fs) = m!^(/[^=]*)!; + $Q{$fs} = '0:0:0:0:0:0'; + print STDERR "Failed to setquota: $fs=$Q{$fs}\n" if setquota($entry->get_value('uid'), $fs, $Q{$fs}); + } + } + } + } else { + if ( keys %Q ) { + foreach my $fs ( keys %Q ) { + my $modify = $ldap->modify($entry->dn, add => {$attr => "$fs=$Q{$fs}"}); + if ( $modify->code ) { + print STDERR "Failed to add $attr: $fs=$Q{$fs}: ", error($modify), "\n"; + } else { + print STDERR "Failed to setquota: $fs=$Q{$fs}\n" if setquota($entry->get_value('uid'), $fs, $Q{$fs}); + } + } + } + } + } +} + +sub setquota { + $_[2] = '0:0:0:0:0:0' unless $_[2]; + $_[2] =~ /^(\d+):(\d+):(\d+):(\d+):(\d+):(\d+)$/; + qx{/usr/sbin/setquota -u $_[0] $1 $2 $4 $5 $_[1]}; + qx{/usr/sbin/setquota -T -u $_[0] $3 $6 $_[1]}; + return 0; +} + +sub checkQ { + my (%Q) = @_; + foreach ( keys %Q ) { + die "$_: invalid format\n" unless m!^(/[^=]*)! && $Q{$_} =~ /^(\d+):(\d+):(\d+):(\d+):(\d+):(\d+)$/; + } + return %Q; +} + +sub bindpw { + my ($passwordfile) = @_; + open P, $passwordfile or die "Can't open passwordfile: $!"; + chomp(my $password = <P>); + close P; + return $password; +} + +sub error { + return $_[0]->error, "(", $_[0]->code, ")"; +} diff --git a/sys-fs/quota/files/quota-4.03-default_fpic_fpie.patch b/sys-fs/quota/files/quota-4.03-default_fpic_fpie.patch new file mode 100644 index 000000000000..2ff519f2b846 --- /dev/null +++ b/sys-fs/quota/files/quota-4.03-default_fpic_fpie.patch @@ -0,0 +1,32 @@ +commit cd9dff0b5b53279442458360003831b6c14adc22 +Author: Tomáš Chvátal <tchvatal@suse.com> +Date: Tue Jan 5 11:20:52 2016 +0100 + + Set -fPIC and -pie as default params when building + + Signed-off-by: Tomáš Chvátal <tchvatal@suse.cz> + Signed-off-by: Jan Kara <jack@suse.cz> + +diff --git a/Makefile.am b/Makefile.am +index 7c7a866..77f8400 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -1,4 +1,5 @@ + ACLOCAL_AMFLAGS = -I m4 ++AM_LDFLAGS = -pie + + BUILT_SOURCES = rquota.h rquota.c rquota_clnt.c + +diff --git a/configure.ac b/configure.ac +index 1552c15..68d5924 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -53,7 +53,7 @@ AS_IF([test "x${prefix}" = "xNONE"], [ + # ================ + # Check for cflags + # ================ +-CFLAGS="$CFLAGS -D_GNU_SOURCE -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" ++CFLAGS="$CFLAGS -D_GNU_SOURCE -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" + AC_ARG_ENABLE([werror], + [AS_HELP_STRING([--enable-werror], [Treat all warnings as errors, useful for development])], + [enable_werror="$enableval"], diff --git a/sys-fs/quota/files/quota-4.03-distribute_ldap-scripts.patch b/sys-fs/quota/files/quota-4.03-distribute_ldap-scripts.patch new file mode 100644 index 000000000000..83339159e0fb --- /dev/null +++ b/sys-fs/quota/files/quota-4.03-distribute_ldap-scripts.patch @@ -0,0 +1,23 @@ +commit 861154efb90ed049e0473cc36935b8d03c78a869 +Author: Tomáš Chvátal <tchvatal@suse.com> +Date: Mon Jan 4 13:01:36 2016 +0100 + + Distribute ldap-scripts directory too + + Signed-off-by: Tomáš Chvátal <tchvatal@suse.com> + Signed-off-by: Jan Kara <jack@suse.cz> + +diff --git a/Makefile.am b/Makefile.am +index eb62617..a880ebe 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -52,7 +52,8 @@ EXTRA_DIST = \ + $(man_MANS) \ + $(rpcsvc_DATA) \ + autogen.sh \ +- Changelog ++ Changelog \ ++ ldap-scripts + + noinst_LIBRARIES = \ + libquota.a \ diff --git a/sys-fs/quota/files/quota-4.03-dont_override_cflags.patch b/sys-fs/quota/files/quota-4.03-dont_override_cflags.patch new file mode 100644 index 000000000000..e59341a702ac --- /dev/null +++ b/sys-fs/quota/files/quota-4.03-dont_override_cflags.patch @@ -0,0 +1,22 @@ +commit 776757a23e9930588950c7fcbc7827ec7a3e51c4 +Author: Tomáš Chvátal <tchvatal@suse.com> +Date: Mon Jan 4 15:48:19 2016 +0100 + + Do not accidentaly override commandline passed CFLAGS. + + Signed-off-by: Tomáš Chvátal <tchvatal@suse.com> + Signed-off-by: Jan Kara <jack@suse.cz> + +diff --git a/configure.ac b/configure.ac +index 3ba1386..1552c15 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -53,7 +53,7 @@ AS_IF([test "x${prefix}" = "xNONE"], [ + # ================ + # Check for cflags + # ================ +-CFLAGS="-D_GNU_SOURCE -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" ++CFLAGS="$CFLAGS -D_GNU_SOURCE -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" + AC_ARG_ENABLE([werror], + [AS_HELP_STRING([--enable-werror], [Treat all warnings as errors, useful for development])], + [enable_werror="$enableval"], diff --git a/sys-fs/quota/files/quota-4.03-explicitely_print_disabled_options.patch b/sys-fs/quota/files/quota-4.03-explicitely_print_disabled_options.patch new file mode 100644 index 000000000000..29627c03ab32 --- /dev/null +++ b/sys-fs/quota/files/quota-4.03-explicitely_print_disabled_options.patch @@ -0,0 +1,69 @@ +commit 6ccb66159a9eee6ca114b11b70eb06f4ac6900d7 +Author: Jan Kara <jack@suse.cz> +Date: Mon Jan 4 15:36:27 2016 +0100 + + Print explicitely disabled options properly + + Currently we printed only an empty string when some build option was + disabled explicitely via --disable-foo. Print 'no' in that case as well. + + Signed-off-by: Jan Kara <jack@suse.cz> + +diff --git a/configure.ac b/configure.ac +index 39631c4..3ba1386 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -74,7 +74,7 @@ AC_ARG_ENABLE([ldapmail], + AS_IF([test "x$enable_ldapmail" != "xno"], [ + build_ldap="yes" + AC_CHECK_LIB([ldap], [ldap_initialize], [], [ +- build_ldap=no ++ build_ldap="no" + AS_IF([test "x$enable_ldapmail" = "xyes"], [ + AC_MSG_ERROR([LDAP support required but library not found.]); + ]) +@@ -84,6 +84,8 @@ AS_IF([test "x$enable_ldapmail" != "xno"], [ + AC_DEFINE([USE_LDAP_MAIL_LOOKUP], 1, [Lookup email address using LDAP]) + COMPILE_OPTS="$COMPILE_OPTS USE_LDAP_MAIL_LOOKUP" + ]) ++], [ ++ build_ldap="no" + ]) + AC_SUBST(LDAP_LIBS) + +@@ -113,6 +115,8 @@ AS_IF([test "x$enable_ext2direct" != "xno"], [ + AC_DEFINE([EXT2_DIRECT], 1, [Scanning of ext? filesystems using e2fslib]) + COMPILE_OPTS="$COMPILE_OPTS EXT2_DIRECT" + ]) ++], [ ++ build_ext2direct="no" + ]) + AC_SUBST(EXT2FS_CFLAGS) + AC_SUBST(EXT2FS_LIBS) +@@ -141,6 +145,8 @@ AS_IF([test "x$enable_netlink" != "xno"], [ + AC_MSG_ERROR([Required libnl3 libraries for quota netlink daemon not found.]) + ]) + ]) ++], [ ++ build_netlink="no" + ]) + AM_CONDITIONAL([WITH_NETLINK], [test "x$build_netlink" != "xno"]) + AC_SUBST(DBUS_CFLAGS) +@@ -171,6 +177,8 @@ AS_IF([test "x$enable_libwrap" != "xno"], [ + AC_DEFINE([HOSTS_ACCESS], 1, [Use hosts.allow and hosts.deny for access checking of rpc.rquotad]) + COMPILE_OPTS="$COMPILE_OPTS HOSTS_ACCESS" + ]) ++], [ ++ build_libwrap="no" + ]) + AC_SUBST(WRAP_LIBS) + +@@ -199,6 +207,8 @@ AS_IF([test x"$enable_rpc" != "xno"], [ + AC_DEFINE([RPC], 1, [Support for RPC]) + COMPILE_OPTS="$COMPILE_OPTS RPC" + ]) ++], [ ++ build_rpc="no" + ]) + AM_CONDITIONAL([WITH_RPC], [test x"$build_rpc" != "xno"]) + diff --git a/sys-fs/quota/files/quota-4.03-fix_build_without_ldap.patch b/sys-fs/quota/files/quota-4.03-fix_build_without_ldap.patch new file mode 100644 index 000000000000..ba838bfe2838 --- /dev/null +++ b/sys-fs/quota/files/quota-4.03-fix_build_without_ldap.patch @@ -0,0 +1,85 @@ +commit 39fd30ce57e3c34c3649866bf9345a71f0b78667 +Author: Jan Kara <jack@suse.cz> +Date: Mon Jan 4 15:10:53 2016 +0100 + + Fix build with disabled ldap + + Reported-by: Tomas Chvatal <tchvatal@suse.com> + Signed-off-by: Jan Kara <jack@suse.cz> + +diff --git a/warnquota.c b/warnquota.c +index 3734f0e..e9868c1 100644 +--- a/warnquota.c ++++ b/warnquota.c +@@ -109,13 +109,13 @@ struct configparams { + char *user_signature; + char *group_message; + char *group_signature; ++ time_t cc_before; ++#ifdef USE_LDAP_MAIL_LOOKUP + int use_ldap_mail; /* 0 */ ++ int ldap_is_setup; /* 0 */ + int ldap_starttls; /* 0 */ + int ldap_tls; /* LDAP_OPT_X_TLS_NEVER */ + int ldap_vers; /* LDAP_VERSION3 */ +- time_t cc_before; +-#ifdef USE_LDAP_MAIL_LOOKUP +- int ldap_is_setup; /* 0 */ + char ldap_host[CNF_BUFFER]; + int ldap_port; + char ldap_uri[CNF_BUFFER]; +@@ -729,13 +729,13 @@ static int readconfigfile(const char *filename, struct configparams *config) + } + maildev[0] = 0; + config->user_signature = config->user_message = config->group_signature = config->group_message = NULL; ++ config->cc_before = -1; ++ ++#ifdef USE_LDAP_MAIL_LOOKUP + config->use_ldap_mail = 0; + config->ldap_starttls = 0; + config->ldap_tls = LDAP_OPT_X_TLS_NEVER; + config->ldap_vers = LDAP_VERSION3; +- config->cc_before = -1; +- +-#ifdef USE_LDAP_MAIL_LOOKUP + config->ldap_port = config->ldap_is_setup = 0; + config->ldap_host[0] = 0; + config->ldap_uri[0] = 0; +@@ -820,6 +820,18 @@ static int readconfigfile(const char *filename, struct configparams *config) + create_eoln(config->group_signature); + verify_format(config->group_signature, "GROUP_SIGNATURE"); + } ++ else if (!strcmp(var, "CC_BEFORE")) { ++ int num; ++ char unit[10]; ++ ++ if (sscanf(value, "%d%s", &num, unit) != 2) ++ goto cc_parse_err; ++ if (str2timeunits(num, unit, &config->cc_before) < 0) { ++cc_parse_err: ++ die(1, _("Cannot parse time at CC_BEFORE variable (line %d).\n"), line); ++ } ++ } ++#ifdef USE_LDAP_MAIL_LOOKUP + else if (!strcmp(var, "LDAP_MAIL")) { + if(strcasecmp(value, "true") == 0) + config->use_ldap_mail = 1; +@@ -846,18 +858,6 @@ static int readconfigfile(const char *filename, struct configparams *config) + else + config->ldap_starttls = 0; + } +- else if (!strcmp(var, "CC_BEFORE")) { +- int num; +- char unit[10]; +- +- if (sscanf(value, "%d%s", &num, unit) != 2) +- goto cc_parse_err; +- if (str2timeunits(num, unit, &config->cc_before) < 0) { +-cc_parse_err: +- die(1, _("Cannot parse time at CC_BEFORE variable (line %d).\n"), line); +- } +- } +-#ifdef USE_LDAP_MAIL_LOOKUP + else if (!strcmp(var, "LDAP_HOST")) + sstrncpy(config->ldap_host, value, CNF_BUFFER); + else if (!strcmp(var, "LDAP_PORT")) diff --git a/sys-fs/quota/files/quota-4.03-no_rpc.patch b/sys-fs/quota/files/quota-4.03-no_rpc.patch new file mode 100644 index 000000000000..c4f5007fca5d --- /dev/null +++ b/sys-fs/quota/files/quota-4.03-no_rpc.patch @@ -0,0 +1,57 @@ +From 07ec5c783ac16ed20735d6cb8ab167833f5877ee Mon Sep 17 00:00:00 2001 +From: Lars Wendler <polynomial-c@gentoo.org> +Date: Mon, 15 Feb 2016 14:36:28 +0100 +Subject: [PATCH] Don't build rpc.rquotad when --disable-rpc was requested. + +This fixes a buch of undefined references: + +x86_64-pc-linux-gnu-gcc -march=native -mtune=native -O2 -pipe -D_GNU_SOURCE -Wa +ll -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -pie -Wl,-O1 -Wl,--hash-st +yle=gnu -Wl,--sort-common -Wl,--as-needed -o rpc.rquotad rquota_server.o rquota_ +svc.o svc_socket.o libquota.a +rquota_svc.o: In function `rquotaprog_2': +rquota_svc.c:(.text+0x1d3): undefined reference to `xdr_setquota_rslt' +rquota_svc.c:(.text+0x1da): undefined reference to `xdr_ext_setquota_args' +rquota_svc.c:(.text+0x2b2): undefined reference to `xdr_setquota_rslt' +rquota_svc.c:(.text+0x2b9): undefined reference to `xdr_ext_setquota_args' +rquota_svc.c:(.text+0x2ff): undefined reference to `xdr_getquota_rslt' +rquota_svc.c:(.text+0x306): undefined reference to `xdr_ext_getquota_args' +rquota_svc.c:(.text+0x31a): undefined reference to `xdr_getquota_rslt' +rquota_svc.c:(.text+0x321): undefined reference to `xdr_ext_getquota_args' +rquota_svc.o: In function `rquotaprog_1': +rquota_svc.c:(.text+0x3f3): undefined reference to `xdr_setquota_rslt' +rquota_svc.c:(.text+0x3fa): undefined reference to `xdr_setquota_args' +rquota_svc.c:(.text+0x4d2): undefined reference to `xdr_setquota_rslt' +rquota_svc.c:(.text+0x4d9): undefined reference to `xdr_setquota_args' +rquota_svc.c:(.text+0x51f): undefined reference to `xdr_getquota_rslt' +rquota_svc.c:(.text+0x526): undefined reference to `xdr_getquota_args' +rquota_svc.c:(.text+0x53a): undefined reference to `xdr_getquota_rslt' +rquota_svc.c:(.text+0x541): undefined reference to `xdr_getquota_args' +collect2: error: ld returned 1 exit status +Makefile:901: recipe for target 'rpc.rquotad' failed + +Signed-off-by: Lars Wendler <polynomial-c@gentoo.org> +--- + Makefile.am | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index 77f8400..6d7ea0e 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -116,8 +116,11 @@ sbin_PROGRAMS = \ + xqmstats \ + edquota \ + setquota \ +- convertquota \ ++ convertquota ++if WITH_RPC ++sbin_PROGRAMS += \ + rpc.rquotad ++endif + if WITH_NETLINK + sbin_PROGRAMS += \ + quota_nld +-- +2.7.1 + diff --git a/sys-fs/quota/files/quota-4.03-noldap_linking.patch b/sys-fs/quota/files/quota-4.03-noldap_linking.patch new file mode 100644 index 000000000000..dbaca69bb7d3 --- /dev/null +++ b/sys-fs/quota/files/quota-4.03-noldap_linking.patch @@ -0,0 +1,75 @@ +commit 1d9542df5d2ae5c21a1e96d100f899b3d7b2f27c +Author: Jan Kara <jack@suse.cz> +Date: Tue Jan 19 11:40:15 2016 +0100 + + Don't link all binaries with ldap library + + The default action-if-found of AC_CHECK_LIB() is to append checked + library to LIBS. Thus check for ldap library resulted in unwanted + addition of -lldap to LIBS as [] is an empty string in M4 and the + default action is used. + + Fix the problem by providing proper action-if-found which was currently + just hidden behind the check. Also do similar cleanup for + AC_CHECK_HEADER check although there it didn't have any undesired + side-effect. + + Reported-by: Petr Písař <petrp@users.sf.net> + Signed-off-by: Jan Kara <jack@suse.cz> + +diff --git a/configure.ac b/configure.ac +index 68d5924..d17b18c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -72,18 +72,17 @@ AC_ARG_ENABLE([ldapmail], + [enable_ldapmail=auto] + ) + AS_IF([test "x$enable_ldapmail" != "xno"], [ +- build_ldap="yes" +- AC_CHECK_LIB([ldap], [ldap_initialize], [], [ ++ AC_CHECK_LIB([ldap], [ldap_initialize], [ ++ build_ldap="yes" ++ LDAP_LIBS="-lldap -llber" ++ AC_DEFINE([USE_LDAP_MAIL_LOOKUP], 1, [Lookup email address using LDAP]) ++ COMPILE_OPTS="$COMPILE_OPTS USE_LDAP_MAIL_LOOKUP" ++ ], [ + build_ldap="no" + AS_IF([test "x$enable_ldapmail" = "xyes"], [ + AC_MSG_ERROR([LDAP support required but library not found.]); + ]) + ]) +- AS_IF([test "x$build_ldap" = "xyes"], [ +- LDAP_LIBS="-lldap -llber" +- AC_DEFINE([USE_LDAP_MAIL_LOOKUP], 1, [Lookup email address using LDAP]) +- COMPILE_OPTS="$COMPILE_OPTS USE_LDAP_MAIL_LOOKUP" +- ]) + ], [ + build_ldap="no" + ]) +@@ -163,8 +162,12 @@ AC_ARG_ENABLE([libwrap], + [enable_libwrap=auto] + ) + AS_IF([test "x$enable_libwrap" != "xno"], [ +- build_libwrap="yes" +- AC_CHECK_HEADER([tcpd.h],[], [ ++ AC_CHECK_HEADER([tcpd.h], [ ++ build_libwrap="yes" ++ WRAP_LIBS="-lwrap" ++ AC_DEFINE([HOSTS_ACCESS], 1, [Use hosts.allow and hosts.deny for access checking of rpc.rquotad]) ++ COMPILE_OPTS="$COMPILE_OPTS HOSTS_ACCESS" ++ ], [ + build_libwrap="no" + AS_IF([test "x$enable_libwrap" = "xyes"] , [ + AC_MSG_ERROR([tcpd.h not found and requested]) +@@ -172,11 +175,6 @@ AS_IF([test "x$enable_libwrap" != "xno"], [ + AC_MSG_WARN([tcpd.h not found]) + ]) + ]) +- AS_IF([test "x$build_libwrap" != "xno"], [ +- WRAP_LIBS="-lwrap" +- AC_DEFINE([HOSTS_ACCESS], 1, [Use hosts.allow and hosts.deny for access checking of rpc.rquotad]) +- COMPILE_OPTS="$COMPILE_OPTS HOSTS_ACCESS" +- ]) + ], [ + build_libwrap="no" + ]) diff --git a/sys-fs/quota/files/quota-4.03-repqouta_F_option_arg.patch b/sys-fs/quota/files/quota-4.03-repqouta_F_option_arg.patch new file mode 100644 index 000000000000..d4fffd4f03fa --- /dev/null +++ b/sys-fs/quota/files/quota-4.03-repqouta_F_option_arg.patch @@ -0,0 +1,27 @@ +commit ab2bf5b51a1ca14cef63e8a7a88b039f173a210a +Author: Eric Sandeen <sandeen@redhat.com> +Date: Mon Jan 18 20:11:01 2016 -0600 + + repquota: -F option takes an arg + + Commit a5876145 added a new -O option which takes an + argument, but in the process lost the argument specifier + for "F". As a result, the use of "-F" segfaults when NULL + is sent to name2fmt() instead of the provided argument. + + Signed-off-by: Eric Sandeen <sandeen@redhat.com> + Signed-off-by: Jan Kara <jack@suse.cz> + +diff --git a/repquota.c b/repquota.c +index 744af70..6fe9f0c 100644 +--- a/repquota.c ++++ b/repquota.c +@@ -90,7 +90,7 @@ static void parse_options(int argcnt, char **argstr) + { NULL, 0, NULL, 0 } + }; + +- while ((ret = getopt_long(argcnt, argstr, "VavughtspncCiFO:", long_opts, NULL)) != -1) { ++ while ((ret = getopt_long(argcnt, argstr, "VavughtspncCiF:O:", long_opts, NULL)) != -1) { + switch (ret) { + case '?': + case 'h': diff --git a/sys-fs/quota/files/quota-4.03-respect_docdir.patch b/sys-fs/quota/files/quota-4.03-respect_docdir.patch new file mode 100644 index 000000000000..214b3ad1f17a --- /dev/null +++ b/sys-fs/quota/files/quota-4.03-respect_docdir.patch @@ -0,0 +1,21 @@ +commit cac9a60c29106763cc6abd6f372f25f97d4122a3 +Author: Tomáš Chvátal <tchvatal@suse.com> +Date: Mon Jan 4 15:26:36 2016 +0100 + + Respect the docdir declaration and do not override. + + Signed-off-by: Tomáš Chvátal <tchvatal@suse.com> + Signed-off-by: Jan Kara <jack@suse.cz> + +diff --git a/Makefile.am b/Makefile.am +index a880ebe..7c7a866 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -2,7 +2,6 @@ ACLOCAL_AMFLAGS = -I m4 + + BUILT_SOURCES = rquota.h rquota.c rquota_clnt.c + +-docdir = $(datadir)/doc/@PACKAGE@ + doc_DATA = \ + README.mailserver \ + README.ldap-support \ diff --git a/sys-fs/quota/files/quota-4.04-glibc226.patch b/sys-fs/quota/files/quota-4.04-glibc226.patch new file mode 100644 index 000000000000..5f63cde7d426 --- /dev/null +++ b/sys-fs/quota/files/quota-4.04-glibc226.patch @@ -0,0 +1,43 @@ +From bbb8819fc0f6ed379a05d635a61bcf9c8986079f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org> +Date: Sat, 16 Sep 2017 13:09:43 +0200 +Subject: [PATCH] Add $(TIRPC_CFLAGS) globally to CFLAGS for RPC support, + needed for libc 2.26 + +--- + Makefile.am | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 8d80bee..278290a 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -51,6 +51,8 @@ EXTRA_DIST = \ + noinst_LIBRARIES = libquota.a + + if WITH_RPC ++CFLAGS += $(TIRPC_CFLAGS) ++ + rpcsvcdir = $(includedir)/rpcsvc + rpcsvc_DATA = \ + rquota.h \ +@@ -100,8 +102,6 @@ libquota_a_SOURCES = \ + mntopt.h \ + pot.c \ + pot.h +-libquota_a_CFLAGS = \ +- $(TIRPC_CFLAGS) + libquota_a_LIBADD = \ + $(RPCLIBS) + +@@ -235,7 +235,6 @@ rpc_rquotad_SOURCES = \ + rquota_server.c \ + rquota_svc.c \ + svc_socket.c +-rpc_rquotad_CFLAGS = $(TIRPC_CFLAGS) + rpc_rquotad_LDADD = \ + libquota.a \ + $(WRAP_LIBS) \ +-- +2.14.1 + diff --git a/sys-fs/quota/files/quota.confd b/sys-fs/quota/files/quota.confd new file mode 100644 index 000000000000..6e66c88dda14 --- /dev/null +++ b/sys-fs/quota/files/quota.confd @@ -0,0 +1,20 @@ +# /etc/conf.d/quota: config file for /etc/init.d/quota + +# Note: if your console is hooked up to a serial terminal, +# you prob want to drop the '-v' from the OPTS vars below. + + +# Run quotacheck ? +RUN_QUOTACHECK="yes" + + +# Options for quotacheck +QUOTACHECK_OPTS="-avug" + + +# Options for quotaon +QUOTAON_OPTS="-avug" + + +# Options for quotaoff +QUOTAOFF_OPTS="-avug" diff --git a/sys-fs/quota/files/quota.rc7 b/sys-fs/quota/files/quota.rc7 new file mode 100644 index 000000000000..bfc06232e992 --- /dev/null +++ b/sys-fs/quota/files/quota.rc7 @@ -0,0 +1,37 @@ +#!/sbin/openrc-run +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 + +extra_started_commands="check" +description_check="Running quotacheck with quota being offline" + +depend() { + need localmount + use portmap +} + +start() { + if [ "${RUN_QUOTACHECK}" = "yes" ] ; then + ebegin "Checking quotas (may take a while)" + quotacheck ${QUOTACHECK_OPTS} + eend $? + fi + + ebegin "Starting quota" + quotaon ${QUOTAON_OPTS} + eend $? +} + +stop() { + ebegin "Stopping quota" + quotaoff ${QUOTAOFF_OPTS} + eend $? +} + +check() { + ebegin "Checking quota" + quotaoff ${QUOTAOFF_OPTS} && \ + quotacheck ${QUOTACHECK_OPTS} && \ + quotaon ${QUOTAON_OPTS} + eend $? +} diff --git a/sys-fs/quota/files/rpc.rquotad.initd b/sys-fs/quota/files/rpc.rquotad.initd new file mode 100644 index 000000000000..528e46bf6bfa --- /dev/null +++ b/sys-fs/quota/files/rpc.rquotad.initd @@ -0,0 +1,25 @@ +#!/sbin/openrc-run +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs + +rpc_bin=/usr/sbin/rpc.rquotad + +depend() { + use ypbind net + need portmap + after quota +} + +start() { + ebegin "Starting rpc.rquotad" + ${rpc_bin} ${OPTS_RPC_RQUOTAD} + eend $? +} + +stop() { + ebegin "Stopping rpc.rquotad" + start-stop-daemon --stop --quiet --exec ${rpc_bin} + eend $? +} diff --git a/sys-fs/quota/metadata.xml b/sys-fs/quota/metadata.xml new file mode 100644 index 000000000000..3787c4c41e98 --- /dev/null +++ b/sys-fs/quota/metadata.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="project"> + <email>base-system@gentoo.org</email> + <name>Gentoo Base System</name> +</maintainer> +<use> + <flag name="netlink">Compile daemon receiving quota messages via netlink</flag> + <flag name="rpc">Enable quota interaction via RPC</flag> +</use> +<upstream> + <remote-id type="sourceforge">linuxquota</remote-id> +</upstream> +</pkgmetadata> diff --git a/sys-fs/quota/quota-4.03.ebuild b/sys-fs/quota/quota-4.03.ebuild new file mode 100644 index 000000000000..28fb821fc5d6 --- /dev/null +++ b/sys-fs/quota/quota-4.03.ebuild @@ -0,0 +1,83 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +inherit autotools eutils + +DESCRIPTION="Linux quota tools" +HOMEPAGE="https://sourceforge.net/projects/linuxquota/" +SRC_URI="mirror://sourceforge/linuxquota/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sparc x86" +IUSE="ldap netlink nls rpc tcpd" + +RDEPEND="ldap? ( >=net-nds/openldap-2.3.35 ) + netlink? ( + sys-apps/dbus + dev-libs/libnl:3 + ) + rpc? ( net-nds/rpcbind ) + tcpd? ( sys-apps/tcp-wrappers )" +DEPEND="${RDEPEND} + nls? ( sys-devel/gettext )" + +PATCHES=( + # Patches from upstream + "${FILESDIR}/${P}-fix_build_without_ldap.patch" + "${FILESDIR}/${P}-distribute_ldap-scripts.patch" + "${FILESDIR}/${P}-explicitely_print_disabled_options.patch" + "${FILESDIR}/${P}-respect_docdir.patch" + "${FILESDIR}/${P}-dont_override_cflags.patch" + "${FILESDIR}/${P}-default_fpic_fpie.patch" + "${FILESDIR}/${P}-repqouta_F_option_arg.patch" + "${FILESDIR}/${P}-noldap_linking.patch" + + # Patches not (yet) upstreamed + "${FILESDIR}/${P}-no_rpc.patch" +) + +src_prepare() { + epatch "${PATCHES[@]}" + + eautoreconf +} + +src_configure() { + econf \ + --docdir="${EPREFIX}/usr/share/doc/${PF}" \ + $(use_enable nls) \ + $(use_enable ldap ldapmail) \ + $(use_enable netlink) \ + $(use_enable rpc) \ + $(use_enable rpc rpcsetquota) +} + +src_install() { + emake DESTDIR="${D}" install + dodoc doc/* README.* Changelog + rm -r "${ED}"/usr/include || die #70938 + + insinto /etc + insopts -m0644 + doins warnquota.conf quotatab + + newinitd "${FILESDIR}"/quota.rc7 quota + newconfd "${FILESDIR}"/quota.confd quota + + if use rpc ; then + newinitd "${FILESDIR}"/rpc.rquotad.initd rpc.rquotad + fi + + if use ldap ; then + insinto /etc/openldap/schema + insopts -m0644 + doins "${FILESDIR}"/ldap-scripts/quota.schema + + exeinto /usr/share/quota/ldap-scripts + doexe "${FILESDIR}"/ldap-scripts/*.pl + doexe "${FILESDIR}"/ldap-scripts/edquota_editor + fi +} diff --git a/sys-fs/quota/quota-4.04-r1.ebuild b/sys-fs/quota/quota-4.04-r1.ebuild new file mode 100644 index 000000000000..0fccc223e077 --- /dev/null +++ b/sys-fs/quota/quota-4.04-r1.ebuild @@ -0,0 +1,83 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit autotools + +DESCRIPTION="Linux quota tools" +HOMEPAGE="https://sourceforge.net/projects/linuxquota/" +SRC_URI="mirror://sourceforge/linuxquota/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86" +IUSE="ldap netlink nls rpc tcpd" + +RDEPEND=" + ldap? ( >=net-nds/openldap-2.3.35 ) + netlink? ( + sys-apps/dbus + dev-libs/libnl:3 + ) + rpc? ( + net-nds/rpcbind + || ( sys-libs/glibc[rpc(-)] + ( + net-libs/rpcsvc-proto + ) + ) + ) + tcpd? ( sys-apps/tcp-wrappers ) +" +DEPEND=" + ${RDEPEND} + nls? ( sys-devel/gettext ) +" + +PATCHES=( + "${FILESDIR}/${P}-glibc226.patch" +) + +src_prepare() { + default + eautoreconf +} + +src_configure() { + local myeconfargs=( + --docdir="${EPREFIX%/}/usr/share/doc/${PF}" + $(use_enable nls) + $(use_enable ldap ldapmail) + $(use_enable netlink) + $(use_enable rpc) + $(use_enable rpc rpcsetquota) + ) + econf "${myeconfargs[@]}" +} + +src_install() { + emake DESTDIR="${D}" install + dodoc doc/* README.* Changelog + + insinto /etc + insopts -m0644 + doins warnquota.conf quotatab + + newinitd "${FILESDIR}"/quota.rc7 quota + newconfd "${FILESDIR}"/quota.confd quota + + if use rpc ; then + newinitd "${FILESDIR}"/rpc.rquotad.initd rpc.rquotad + fi + + if use ldap ; then + insinto /etc/openldap/schema + insopts -m0644 + doins "${FILESDIR}"/ldap-scripts/quota.schema + + exeinto /usr/share/quota/ldap-scripts + doexe "${FILESDIR}"/ldap-scripts/*.pl + doexe "${FILESDIR}"/ldap-scripts/edquota_editor + fi +} diff --git a/sys-fs/quota/quota-4.04.ebuild b/sys-fs/quota/quota-4.04.ebuild new file mode 100644 index 000000000000..d077fb35d664 --- /dev/null +++ b/sys-fs/quota/quota-4.04.ebuild @@ -0,0 +1,79 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit autotools + +DESCRIPTION="Linux quota tools" +HOMEPAGE="https://sourceforge.net/projects/linuxquota/" +SRC_URI="mirror://sourceforge/linuxquota/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86" +IUSE="ldap netlink nls rpc tcpd" + +RDEPEND=" + ldap? ( >=net-nds/openldap-2.3.35 ) + netlink? ( + sys-apps/dbus + dev-libs/libnl:3 + ) + rpc? ( + net-nds/rpcbind + || ( sys-libs/glibc[rpc(-)] + ( + net-libs/rpcsvc-proto + ) + ) + ) + tcpd? ( sys-apps/tcp-wrappers ) +" +DEPEND=" + ${RDEPEND} + nls? ( sys-devel/gettext ) +" + +src_prepare() { + default + eautoreconf +} + +src_configure() { + local myeconfargs=( + --docdir="${EPREFIX%/}/usr/share/doc/${PF}" + $(use_enable nls) + $(use_enable ldap ldapmail) + $(use_enable netlink) + $(use_enable rpc) + $(use_enable rpc rpcsetquota) + ) + econf "${myeconfargs[@]}" +} + +src_install() { + emake DESTDIR="${D}" install + dodoc doc/* README.* Changelog + + insinto /etc + insopts -m0644 + doins warnquota.conf quotatab + + newinitd "${FILESDIR}"/quota.rc7 quota + newconfd "${FILESDIR}"/quota.confd quota + + if use rpc ; then + newinitd "${FILESDIR}"/rpc.rquotad.initd rpc.rquotad + fi + + if use ldap ; then + insinto /etc/openldap/schema + insopts -m0644 + doins "${FILESDIR}"/ldap-scripts/quota.schema + + exeinto /usr/share/quota/ldap-scripts + doexe "${FILESDIR}"/ldap-scripts/*.pl + doexe "${FILESDIR}"/ldap-scripts/edquota_editor + fi +} |