All checks were successful
Build / Build project (push) Successful in 45s
102 lines
3.4 KiB
Diff
102 lines
3.4 KiB
Diff
diff --git a/include/libisns/paths.h.in b/include/libisns/paths.h.in
|
|
index c28a3fa..6c585e8 100644
|
|
--- a/include/libisns/paths.h.in
|
|
+++ b/include/libisns/paths.h.in
|
|
@@ -21,4 +21,19 @@
|
|
|
|
#define ISCSI_DEFAULT_INITIATORNAME "/etc/iscsi/initiatorname.iscsi"
|
|
|
|
+/*
|
|
+ * From: Alexander Zhirov <azhirov1991@gmail.com>
|
|
+ * Date: Wed, 07 May 2025 17:29:43 +0300
|
|
+ * Subject: The default paths to the configuration files have been changed.
|
|
+ */
|
|
+
|
|
+#define ISNS_STATELESS_PATH "/usr/share/defaults"
|
|
+#define ISNS_STATELESS_ISNSD_CONFIG ISNS_STATELESS_PATH ISNS_ETCDIR "/isnsd.conf"
|
|
+#define ISNS_STATELESS_ISNSDD_CONFIG ISNS_STATELESS_PATH ISNS_ETCDIR "/isnsdd.conf"
|
|
+#define ISNS_STATELESS_ISNSADM_CONFIG ISNS_STATELESS_PATH ISNS_ETCDIR "/isnsadm.conf"
|
|
+
|
|
+// `isns.registry` is dynamic configuration file -> /etc/isns/isns.registry
|
|
+
|
|
+#define ISCSI_STATELESS_INITIATORNAME ISNS_STATELESS_PATH ISCSI_DEFAULT_INITIATORNAME
|
|
+
|
|
#endif /* ISNS_CONFIG_H */
|
|
diff --git a/isnsadm.c b/isnsadm.c
|
|
index 40a1a46..853779a 100644
|
|
--- a/isnsadm.c
|
|
+++ b/isnsadm.c
|
|
@@ -97,6 +97,9 @@ main(int argc, char **argv)
|
|
isns_security_t *security = NULL;
|
|
int c, status;
|
|
|
|
+ if (access(opt_configfile, R_OK) != 0)
|
|
+ opt_configfile = ISNS_STATELESS_ISNSADM_CONFIG;
|
|
+
|
|
while ((c = getopt_long(argc, argv, "46Cc:d:hK:k:ls:Vr", options, NULL)) != -1) {
|
|
switch (c) {
|
|
case '4':
|
|
@@ -176,7 +179,10 @@ main(int argc, char **argv)
|
|
/*
|
|
* Try to read the source name from open-iscsi configuration
|
|
*/
|
|
- isns_read_initiatorname(ISCSI_DEFAULT_INITIATORNAME);
|
|
+ const char *iscsi_default_initiatorname = ISCSI_DEFAULT_INITIATORNAME;
|
|
+ if (access(iscsi_default_initiatorname, R_OK) != 0)
|
|
+ iscsi_default_initiatorname = ISCSI_STATELESS_INITIATORNAME;
|
|
+ isns_read_initiatorname(iscsi_default_initiatorname);
|
|
}
|
|
|
|
isns_init_names();
|
|
diff --git a/isnsd.c b/isnsd.c
|
|
index 4031b51..0855a44 100644
|
|
--- a/isnsd.c
|
|
+++ b/isnsd.c
|
|
@@ -64,6 +64,9 @@ main(int argc, char **argv)
|
|
mtrace();
|
|
#endif
|
|
|
|
+ if (access(opt_configfile, R_OK) != 0)
|
|
+ opt_configfile = ISNS_STATELESS_ISNSD_CONFIG;
|
|
+
|
|
while ((c = getopt_long(argc, argv, "46c:d:fh", options, NULL)) != -1) {
|
|
switch (c) {
|
|
case '4':
|
|
@@ -116,7 +119,10 @@ main(int argc, char **argv)
|
|
* Try to read the source name from open-iscsi configuration,
|
|
* using the default iniatiator name
|
|
*/
|
|
- isns_read_initiatorname(ISCSI_DEFAULT_INITIATORNAME);
|
|
+ const char *iscsi_default_initiatorname = ISCSI_DEFAULT_INITIATORNAME;
|
|
+ if (access(iscsi_default_initiatorname, R_OK) != 0)
|
|
+ iscsi_default_initiatorname = ISCSI_STATELESS_INITIATORNAME;
|
|
+ isns_read_initiatorname(iscsi_default_initiatorname);
|
|
}
|
|
|
|
isns_init_names();
|
|
diff --git a/isnsdd.c b/isnsdd.c
|
|
index c2f42d7..872ee4a 100644
|
|
--- a/isnsdd.c
|
|
+++ b/isnsdd.c
|
|
@@ -105,6 +105,9 @@ main(int argc, char **argv)
|
|
mtrace();
|
|
#endif
|
|
|
|
+ if (access(opt_configfile, R_OK) != 0)
|
|
+ opt_configfile = ISNS_STATELESS_ISNSDD_CONFIG;
|
|
+
|
|
while ((c = getopt_long(argc, argv, "46c:d:Efhr:", options, NULL)) != -1) {
|
|
switch (c) {
|
|
case '4':
|
|
@@ -178,7 +181,10 @@ main(int argc, char **argv)
|
|
/*
|
|
* Try to read the source name from open-iscsi configuration
|
|
*/
|
|
- isns_read_initiatorname(ISCSI_DEFAULT_INITIATORNAME);
|
|
+ const char *iscsi_default_initiatorname = ISCSI_DEFAULT_INITIATORNAME;
|
|
+ if (access(iscsi_default_initiatorname, R_OK) != 0)
|
|
+ iscsi_default_initiatorname = ISCSI_STATELESS_INITIATORNAME;
|
|
+ isns_read_initiatorname(iscsi_default_initiatorname);
|
|
}
|
|
|
|
isns_init_names();
|