summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2009-08-14 14:55:17 -0400
committerChris Lumens <clumens@redhat.com>2009-08-17 17:23:46 -0400
commitbcd756ef7e332dccc55d06f5dfda09995e33193a (patch)
tree1d006c0dec8f0aa385d16ffd37e8e953bac63ae4 /loader
parentaebd05aa1e552aae3af7a241f8e38ca3c44e77f8 (diff)
If asked, put the system SN (as given by dmidecode) into an HTTP header.
Diffstat (limited to 'loader')
-rw-r--r--loader/urlinstall.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/loader/urlinstall.c b/loader/urlinstall.c
index 72fa7db60..2dfc62782 100644
--- a/loader/urlinstall.c
+++ b/loader/urlinstall.c
@@ -336,6 +336,38 @@ 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;