Index: /branches/rel_ag_9_4_5/license/src/generate_license.c
===================================================================
--- /branches/rel_ag_9_4_5/license/src/generate_license.c	(revision 20638)
+++ /branches/rel_ag_9_4_5/license/src/generate_license.c	(working copy)
@@ -673,7 +673,8 @@
 	printf( "\nUsage:\n" );
 
 	printf( "\tgenerate_license <serial_number> <model> <max sessions> <max virtual portals>\n"
-		"\t       <features> <expiration_date> <site2site_max_tunnels> <pre-paid flex credit days> <cm_max_device>\n\n");
+		"\t       <features> <expiration_date> <site2site_max_tunnels> <pre-paid flex credit days> <cm_max_device>\n"
+		"\t       [company_name] [avx_vxag_num]\n\n");
 
         printf( "\t<serial_number> -> 30 hexadecimal digits or 52 "
 		"charaters\n" );
@@ -857,26 +858,41 @@
 		 * site2site_tunnels	   -> argv[7]
 		 * credit_days     -> argv[8]
 		 * cm_max_device   -> argv[9]
-		 * company_name    -> argv[10] 
-		 */ 
-		 
-		if ((argc != 11) || ((strlen(argv[1]) != (SERNUMLEN-1)) 
-				  && (strlen(argv[1]) != (MACLEN-1)) 
-				  && (strlen(argv[1]) != (ARRAYKEYLEN-1)))) {
+		 * company_name    -> argv[10] (optional)
+		 * avx_vxag_num    -> argv[11] (optional)
+		 */
+
+		if (argc < 10 || argc > 12) {
 			usage();
 			return 0;
-		} 
+		}
 
 		max_session = atoi(argv[3]);
 		max_vportals = atoi(argv[4]);
 		site2site_max_tunnels = atoi(argv[7]);
 		credit_days = atoi(argv[8]);
 		cm_max_device = atoi(argv[9]);
-		avx_vxag_num = atoi(argv[11]);
-		
+
+		if (argc >= 11) {
+			coname = argv[10];
+		} else {
+			coname = "";
+		}
+
+		if (argc >= 12) {
+			avx_vxag_num = atoi(argv[11]);
+		} else {
+			avx_vxag_num = 0;
+		}
+
 		if (string_to_feature_bits(argv[5], feature) != 0){
-			printf("%s--wrong feature string: %s\n", __FUNCTION__, argv[5]); 
-			return -1; 
+			printf("%s--wrong feature string: %s\n", __FUNCTION__, argv[5]);
+			return -1;
+		}
+
+		if (strcmp(argv[6], "99999999") == 0) {
+			/* permanent license will has this feature by default */
+			LICENSE_UNSET(feature, AFM_SWMAINTENANCE);
 		}
 
 		if (checkinput(argv[6], feature, argv[2], max_session, max_vportals,
