瀏覽代碼

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

tags/v0.9.3
Michael Brown 17 年之前
父節點
當前提交
d05d8edd42
共有 2 個文件被更改,包括 23 次插入3 次删除
  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 查看文件

@@ -32,6 +32,15 @@
32 32
 #include "pxe.h"
33 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 45
  * UNLOAD BASE CODE STACK
37 46
  *
@@ -122,6 +131,12 @@ PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO
122 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 140
 	/* Copy packet to client buffer */
126 141
 	buffer = real_to_user ( get_cached_info->Buffer.segment,
127 142
 				get_cached_info->Buffer.offset );
@@ -150,6 +165,14 @@ PXENV_EXIT_t pxenv_restart_tftp ( struct s_PXENV_TFTP_READ_FILE
150 165
 
151 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 176
 	/* Words cannot describe the complete mismatch between the PXE
154 177
 	 * specification and any possible version of reality...
155 178
 	 */

+ 0
- 3
src/interface/pxe/pxe_tftp.c 查看文件

@@ -65,9 +65,6 @@ static void pxe_tftp_build_uri ( char *uri_string,
65 65
 				 int blksize ) {
66 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 68
 	address.s_addr = ipaddress;
72 69
 	if ( ! port )
73 70
 		port = htons ( TFTP_PORT );

Loading…
取消
儲存