quota/0001-Limit-maximum-of-RPC-port.patch
2020-01-11 12:19:21 +08:00

38 lines
1.2 KiB
Diff

From 7f45919a7b70824e49687f11a43ebc09b4bca2c2 Mon Sep 17 00:00:00 2001
From: renxudong <renxudong1@huawei.com>
Date: Sat, 11 Jan 2020 12:13:45 +0800
Subject: Limit maximum of RPC port
---
rquota_svc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/rquota_svc.c b/rquota_svc.c
index 6e856bb..d0be63f 100644
--- a/rquota_svc.c
+++ b/rquota_svc.c
@@ -53,6 +53,12 @@ int deny_severity, allow_severity; /* Needed by some versions of libwrap */
char *progname;
/*
+ * Port upper and lower limits
+ */
+#define PORT_UPPER 0xFFFF
+#define PORT_LOWER 0
+
+/*
* Global authentication credentials.
*/
struct authunix_parms *unix_cred;
@@ -140,7 +146,7 @@ static void parse_options(int argc, char **argv)
break;
case 'p':
port = strtol(optarg, &endptr, 0);
- if (*endptr || port <= 0) {
+ if (*endptr || port <= PORT_LOWER || port > PORT_UPPER) {
errstr(_("Illegal port number: %s\n"), optarg);
show_help();
exit(1);
--
1.8.3.1