View | Details | Raw Unified | Return to bug 30816
Collapse All | Expand All

(-)edquota.8 (+13 lines)
Lines 44-61 Link Here
44
.Sh SYNOPSIS
44
.Sh SYNOPSIS
45
.Nm
45
.Nm
46
.Op Fl u
46
.Op Fl u
47
.Op Fl f Ar fspath
47
.Op Fl p Ar proto-username
48
.Op Fl p Ar proto-username
48
.Ar username ...
49
.Ar username ...
49
.Nm
50
.Nm
50
.Fl g
51
.Fl g
52
.Op Fl f Ar fspath
51
.Op Fl p Ar proto-groupname
53
.Op Fl p Ar proto-groupname
52
.Ar groupname ...
54
.Ar groupname ...
53
.Nm
55
.Nm
54
.Fl t
56
.Fl t
55
.Op Fl u
57
.Op Fl u
58
.Op Fl f Ar fspath
56
.Nm
59
.Nm
57
.Fl t
60
.Fl t
58
.Fl g
61
.Fl g
62
.Op Fl f Ar fspath
59
.Sh DESCRIPTION
63
.Sh DESCRIPTION
60
.Nm Edquota
64
.Nm Edquota
61
is a quota editor.
65
is a quota editor.
Lines 90-95 Link Here
90
below).
94
below).
91
The current usage information in the file is for informational purposes;
95
The current usage information in the file is for informational purposes;
92
only the hard and soft limits can be changed.
96
only the hard and soft limits can be changed.
97
.Pp
98
If the
99
.Fl f
100
option is specified,
101
.Nm
102
reads and edits quotas only for specified fylesystem. Parameter to
103
.Fl f
104
option may be either special device or mount point of the filesystem
105
selected.
93
.Pp
106
.Pp
94
On leaving the editor,
107
On leaving the editor,
95
.Nm
108
.Nm
(-)edquota.c (-10 / +18 lines)
Lines 89-95 Link Here
89
int editit __P((char *));
89
int editit __P((char *));
90
void freeprivs __P((struct quotause *));
90
void freeprivs __P((struct quotause *));
91
int getentry __P((char *, int));
91
int getentry __P((char *, int));
92
struct quotause *getprivs __P((long, int));
92
struct quotause *getprivs __P((long, int, char *));
93
int hasquota __P((struct fstab *, int, char **));
93
int hasquota __P((struct fstab *, int, char **));
94
void putprivs __P((long, int, struct quotause *));
94
void putprivs __P((long, int, struct quotause *));
95
int readprivs __P((struct quotause *, char *));
95
int readprivs __P((struct quotause *, char *));
Lines 109-114 Link Here
109
	register uid_t startuid, enduid;
109
	register uid_t startuid, enduid;
110
	char *protoname, *cp, ch;
110
	char *protoname, *cp, ch;
111
	int tflag = 0, pflag = 0;
111
	int tflag = 0, pflag = 0;
112
	char *fspath = NULL;
112
	char buf[30];
113
	char buf[30];
113
114
114
	if (argc < 2)
115
	if (argc < 2)
Lines 116-123 Link Here
116
	if (getuid())
117
	if (getuid())
117
		errx(1, "permission denied");
118
		errx(1, "permission denied");
118
	quotatype = USRQUOTA;
119
	quotatype = USRQUOTA;
119
	while ((ch = getopt(argc, argv, "ugtp:")) != -1) {
120
	while ((ch = getopt(argc, argv, "ugtf:p:")) != -1) {
120
		switch(ch) {
121
		switch(ch) {
122
		case 'f':
123
			fspath = optarg;
124
			break;
121
		case 'p':
125
		case 'p':
122
			protoname = optarg;
126
			protoname = optarg;
123
			pflag++;
127
			pflag++;
Lines 140-146 Link Here
140
	if (pflag) {
144
	if (pflag) {
141
		if ((protoid = getentry(protoname, quotatype)) == -1)
145
		if ((protoid = getentry(protoname, quotatype)) == -1)
142
			exit(1);
146
			exit(1);
143
		protoprivs = getprivs(protoid, quotatype);
147
		protoprivs = getprivs(protoid, quotatype, fspath);
144
		for (qup = protoprivs; qup; qup = qup->next) {
148
		for (qup = protoprivs; qup; qup = qup->next) {
145
			qup->dqblk.dqb_btime = 0;
149
			qup->dqblk.dqb_btime = 0;
146
			qup->dqblk.dqb_itime = 0;
150
			qup->dqblk.dqb_itime = 0;
Lines 173-179 Link Here
173
	tmpfd = mkstemp(tmpfil);
177
	tmpfd = mkstemp(tmpfil);
174
	fchown(tmpfd, getuid(), getgid());
178
	fchown(tmpfd, getuid(), getgid());
175
	if (tflag) {
179
	if (tflag) {
176
		protoprivs = getprivs(0, quotatype);
180
		protoprivs = getprivs(0, quotatype, fspath);
177
		if (writetimes(protoprivs, tmpfd, quotatype) == 0)
181
		if (writetimes(protoprivs, tmpfd, quotatype) == 0)
178
			exit(1);
182
			exit(1);
179
		if (editit(tmpfil) && readtimes(protoprivs, tmpfil))
183
		if (editit(tmpfil) && readtimes(protoprivs, tmpfil))
Lines 186-192 Link Here
186
	for ( ; argc > 0; argc--, argv++) {
190
	for ( ; argc > 0; argc--, argv++) {
187
		if ((id = getentry(*argv, quotatype)) == -1)
191
		if ((id = getentry(*argv, quotatype)) == -1)
188
			continue;
192
			continue;
189
		curprivs = getprivs(id, quotatype);
193
		curprivs = getprivs(id, quotatype, fspath);
190
		if (writeprivs(curprivs, tmpfd, *argv, quotatype) == 0)
194
		if (writeprivs(curprivs, tmpfd, *argv, quotatype) == 0)
191
			continue;
195
			continue;
192
		if (editit(tmpfil) && readprivs(curprivs, tmpfil))
196
		if (editit(tmpfil) && readprivs(curprivs, tmpfil))
Lines 202-211 Link Here
202
usage()
206
usage()
203
{
207
{
204
	fprintf(stderr, "%s\n%s\n%s\n%s\n",
208
	fprintf(stderr, "%s\n%s\n%s\n%s\n",
205
		"usage: edquota [-u] [-p username] username ...",
209
		"usage: edquota [-u] [-f fspath] [-p username] username ...",
206
		"       edquota -g [-p groupname] groupname ...",
210
		"       edquota -g [-f fspath] [-p groupname] groupname ...",
207
		"       edquota [-u] -t",
211
		"       edquota [-u] -t [-f fspath]",
208
		"       edquota -g -t");
212
		"       edquota -g -t [-f fspath]");
209
	exit(1);
213
	exit(1);
210
}
214
}
211
215
Lines 247-255 Link Here
247
 * Collect the requested quota information.
251
 * Collect the requested quota information.
248
 */
252
 */
249
struct quotause *
253
struct quotause *
250
getprivs(id, quotatype)
254
getprivs(id, quotatype, fspath)
251
	register long id;
255
	register long id;
252
	int quotatype;
256
	int quotatype;
257
	char *fspath;
253
{
258
{
254
	register struct fstab *fs;
259
	register struct fstab *fs;
255
	register struct quotause *qup, *quptail;
260
	register struct quotause *qup, *quptail;
Lines 262-267 Link Here
262
	quphead = (struct quotause *)0;
267
	quphead = (struct quotause *)0;
263
	qcmd = QCMD(Q_GETQUOTA, quotatype);
268
	qcmd = QCMD(Q_GETQUOTA, quotatype);
264
	while ((fs = getfsent())) {
269
	while ((fs = getfsent())) {
270
		if (fspath && *fspath && strcmp(fspath, fs->fs_spec) &&
271
			strcmp(fspath, fs->fs_file))
272
			continue;
265
		if (strcmp(fs->fs_vfstype, "ufs"))
273
		if (strcmp(fs->fs_vfstype, "ufs"))
266
			continue;
274
			continue;
267
		if (!hasquota(fs, quotatype, &qfpathname))
275
		if (!hasquota(fs, quotatype, &qfpathname))

Return to bug 30816