[PATCH 4/4] If asked, put the system SN (as given by dmidecode) into an HTTP header.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 loader/urlinstall.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/loader/urlinstall.c b/loader/urlinstall.c
index 72fa7db..3dcbef4 100644
--- a/loader/urlinstall.c
+++ b/loader/urlinstall.c
@@ -336,6 +336,37 @@ int getFileFromUrl(char * url, char * dest,
             abort();
         }
 
+        if (FL_KICKSTART_SEND_SERIAL(flags) && !access("/sbin/dmidecode", X_OK)) {
+            FILE *f;
+            char *tmpstr, sn[1024];
+            size_t len;
+
+            if ((f = popen("/sbin/dmidecode -s system-serial-number", "r")) == NULL) {
+                logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__);
+                abort();
+            }
+
+            len = fread(sn, sizeof(char), 1023, f);
+            if (ferror(f)) {
+                logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__);
+                abort();
+            }
+
+            sn[len] = '\0';
+            pclose(f);
+
+            if (asprintf(&tmpstr, "X-System-Serial-Number: %s\r\n", sn) == -1) {
+                logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__);
+                abort();
+            }
+
+            if (!ehdrs) {
+                ehdrs = strdup(tmpstr);
+            } else {
+                ehdrs = (char *) realloc(ehdrs, strlen(ehdrs)+strlen(tmpstr)+1);
+                strcat(ehdrs, tmpstr);
+        }
+
         if (FL_KICKSTART_SEND_MAC(flags)) {
             /* find all ethernet devices and make a header entry for each one */
             int i;
-- 
1.6.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux