FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux User Repository

 
 
LinkBack Thread Tools
 
Old 11-05-2009, 01:39 PM
Martin Sivak
 
Default Backport code from Fedora to enable ks on ftp server with password (#505424)

---
loader2/kickstart.c | 49 ++++++++++++++++++++++++++++++++++++++++++-------
loader2/kickstart.h | 1 +
2 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/loader2/kickstart.c b/loader2/kickstart.c
index 6768fab..cd327c2 100644
--- a/loader2/kickstart.c
+++ b/loader2/kickstart.c
@@ -301,15 +301,17 @@ int getKickstartFromBlockDevice(char *device, char *path) {
return getFileFromBlockDevice(device, path, "/tmp/ks.cfg");
}

-void getHostandPath(char * ksSource, char **host, char ** file, char * ip) {
- *host = malloc(strlen(ksSource) + 1);
- strcpy(*host, ksSource);
+void getHostPathandLogin(char * ksSource, char **host, char ** file, char ** login, char ** password, char * ip) {
+ char *tmp;
+ char *hostsrc;

- *file = strchr(*host, '/');
+ hostsrc = strdup(ksSource);
+ *host = hostsrc;
+ tmp = strchr(*host, '/');

- if (*file) {
- **file = '';
- *file = *file + 1;
+ if (tmp) {
+ *file = strdup(tmp);
+ *tmp = '';
} else {
*file = malloc(sizeof(char *));
**file = '';
@@ -325,6 +327,39 @@ void getHostandPath(char * ksSource, char **host, char ** file, char * ip) {
*file = sdupprintf("%s%s-kickstart", *file, ip);
logMessage(DEBUGLVL, "getHostandPath file(2): |%s|", *file);
}
+
+ /* Do we have a password? */
+ tmp = strchr(*host, '@');
+ if (tmp != NULL) {
+ *login = *host;
+ *tmp = '';
+ *host = tmp + 1;
+
+ tmp = strchr(*login, ':');
+ if (tmp != NULL) {
+ *password = strdup(tmp + 1);
+ *tmp = '';
+ } else {
+ *password = malloc(sizeof(char *));
+ **password = '';
+ }
+
+ *host = strdup(*host);
+ *login = strdup(*login);
+ free(hostsrc);
+ } else {
+ *login = malloc(sizeof(char *));
+ **login = '';
+ *password = malloc(sizeof(char *));
+ **password = '';
+ free(hostsrc);
+ }
+
+}
+
+void getHostandPath(char * ksSource, char **host, char ** file, char * ip) {
+ char *password, *login;
+ getHostPathandLogin (ksSource, host, file, &login, &password, ip);
}

static char *newKickstartLocation(const char *origLocation) {
diff --git a/loader2/kickstart.h b/loader2/kickstart.h
index 69ba3be..a963479 100644
--- a/loader2/kickstart.h
+++ b/loader2/kickstart.h
@@ -29,5 +29,6 @@ void getKickstartFile(struct loaderData_s * loaderData);
void runKickstart(struct loaderData_s * loaderData);
int getKickstartFromBlockDevice(char *device, char *path);
void getHostandPath(char * ksSource, char **host, char ** file, char * ip);
+void getHostPathandLogin(char * ksSource, char **host, char ** file, char ** login, char ** password, char * ip);

#endif
--
1.6.4.4

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

Thread Tools




All times are GMT. The time now is 10:04 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org