Parcourir la source

Implement the "overwrite TFTP filename" Microsoft RIS bug workaround.

tags/v0.9.3
Michael Brown il y a 17 ans
Parent
révision
d05d8edd42
2 fichiers modifiés avec 23 ajouts et 3 suppressions
  1. 23
    0
      src/interface/pxe/pxe_preboot.c
  2. 0
    3
      src/interface/pxe/pxe_tftp.c

+ 23
- 0
src/interface/pxe/pxe_preboot.c Voir le fichier

32
 #include "pxe.h"
32
 #include "pxe.h"
33
 #include "pxe_call.h"
33
 #include "pxe_call.h"
34
 
34
 
35
+/** Filename used for last TFTP request
36
+ *
37
+ * This is a bug-for-bug compatibility hack needed in order to work
38
+ * with Microsoft Remote Installation Services (RIS).  The filename
39
+ * used in a call to PXENV_RESTART_TFTP must be returned as the DHCP
40
+ * filename in subsequent calls to PXENV_GET_CACHED_INFO.
41
+ */
42
+static char *pxe_ris_filename = NULL;
43
+
35
 /**
44
 /**
36
  * UNLOAD BASE CODE STACK
45
  * UNLOAD BASE CODE STACK
37
  *
46
  *
122
 		goto err;
131
 		goto err;
123
 	}
132
 	}
124
 
133
 
134
+	/* Overwrite filename to work around Microsoft RIS bug */
135
+	if ( pxe_ris_filename ) {
136
+		strncpy ( dhcppkt.dhcphdr->file, pxe_ris_filename,
137
+			  sizeof ( dhcppkt.dhcphdr->file ) );
138
+	}
139
+
125
 	/* Copy packet to client buffer */
140
 	/* Copy packet to client buffer */
126
 	buffer = real_to_user ( get_cached_info->Buffer.segment,
141
 	buffer = real_to_user ( get_cached_info->Buffer.segment,
127
 				get_cached_info->Buffer.offset );
142
 				get_cached_info->Buffer.offset );
150
 
165
 
151
 	DBG ( "PXENV_RESTART_TFTP " );
166
 	DBG ( "PXENV_RESTART_TFTP " );
152
 
167
 
168
+	/* Work around Microsoft RIS bug */
169
+	free ( pxe_ris_filename );
170
+	pxe_ris_filename = strdup ( ( char * ) restart_tftp->FileName );
171
+	if ( ! pxe_ris_filename ) {
172
+		restart_tftp->Status = PXENV_STATUS_OUT_OF_RESOURCES;
173
+		return PXENV_EXIT_FAILURE;
174
+	}
175
+
153
 	/* Words cannot describe the complete mismatch between the PXE
176
 	/* Words cannot describe the complete mismatch between the PXE
154
 	 * specification and any possible version of reality...
177
 	 * specification and any possible version of reality...
155
 	 */
178
 	 */

+ 0
- 3
src/interface/pxe/pxe_tftp.c Voir le fichier

65
 				 int blksize ) {
65
 				 int blksize ) {
66
 	struct in_addr address;
66
 	struct in_addr address;
67
 
67
 
68
-	/* This is a fix to make Microsoft Remote Install Services work (RIS) */
69
-#warning "Overwrite DHCP filename"
70
-
71
 	address.s_addr = ipaddress;
68
 	address.s_addr = ipaddress;
72
 	if ( ! port )
69
 	if ( ! port )
73
 		port = htons ( TFTP_PORT );
70
 		port = htons ( TFTP_PORT );

Chargement…
Annuler
Enregistrer