Index: /branches/rel_apv_10_7_4/usr/click/lib/libdebug/debug_scp.c
===================================================================
--- /branches/rel_apv_10_7_4/usr/click/lib/libdebug/debug_scp.c	(revision 39942)
+++ /branches/rel_apv_10_7_4/usr/click/lib/libdebug/debug_scp.c	(working copy)
@@ -24,6 +24,8 @@
 #include <unistd.h>
 #include <string.h>
 #include <setjmp.h>
+// TWSD-996
+#include <dirent.h>
 #include <click/app/proxy/proxy_errs.h>
 #include <fastlog.h>
 #include "remote_debug.h"
@@ -39,8 +41,44 @@
 	char localfile[DEBUG_FILE_LEN];
 	struct stat s;
 
-	if(strcasecmp(filename, SYS_DEBUG) == 0) {
-		snprintf(localfile, sizeof(localfile), "%s%s.tar.gz", ARRAY_DEBUG_BASE, filename);
+	// TWSD-996: Support both "sys_debug" and full filenames like "sys_debug_20260107_063659.tar.gz"
+	if (strncasecmp(filename, SYS_DEBUG, strlen(SYS_DEBUG)) == 0) {
+		DIR *dp;
+		struct dirent *dirp;
+		int found = 0;
+
+		if ((dp = opendir(ARRAY_DEBUG_BASE)) != NULL) {
+			while ((dirp = readdir(dp)) != NULL) {
+				int has_sys_debug = (strstr(dirp->d_name, "sys_debug") != NULL);
+				int has_tar_gz = (strstr(dirp->d_name, ".tar.gz") != NULL);
+
+				if (has_sys_debug && has_tar_gz) {
+					// TWSD-996
+					// If full filename specified, check for exact match
+					// Check if input has timestamp (contains underscore after "sys_debug")
+					if (strlen(filename) > strlen(SYS_DEBUG) &&
+					    (strchr(filename, '_') != NULL || strstr(filename, ".tar.gz") != NULL)) {
+						// User provided full filename, check exact match
+						if (strcmp(dirp->d_name, filename) == 0) {
+							snprintf(localfile, sizeof(localfile), "%s%s", ARRAY_DEBUG_BASE, dirp->d_name);
+							found = 1;
+							break;
+						}
+					} else {
+						// User provided just "sys_debug", accept any matching file
+						snprintf(localfile, sizeof(localfile), "%s%s", ARRAY_DEBUG_BASE, dirp->d_name);
+						found = 1;
+						break;
+					}
+				}
+			}
+			closedir(dp);
+		}
+
+		if (!found) {
+			return ERR_DEBUG_OK;
+		}
+		// end of TWSD-996
 		bzero(&s, sizeof(s));
 		if (stat(localfile, &s) == -1 || S_ISREG(s.st_mode) == 0) {
 			return ERR_DEBUG_OK;
@@ -120,21 +158,57 @@
 		}
 		
 		detach_debug_shm(debug_shm);
-	} 
+	}
 	if(!IS_DEBUG_FILE(filename)) {
 		printf("Filename should be sys_snap,sys_log,sys_core,app_core,sys_debug,sslkeylog or all.\n");
 		return -1;
 	}
+
 	if(strcasecmp(filename,"all") != 0) {
-		if (strcasecmp(filename,"SYS_DEBUG") == 0) {
-			snprintf(debug_file,sizeof(debug_file),ARRAY_DEBUG_FILE);
-			} else {
-			snprintf(debug_file,sizeof(debug_file),"/var/crash/%s.tar.gz.gpg",filename);
-		}
+		// TWSD-996: Support both "sys_debug" and full filenames like "sys_debug_20260107_063659.tar.gz"
+		if (strncasecmp(filename, SYS_DEBUG, strlen(SYS_DEBUG)) == 0) {
+			// Check for sys_debug files with timestamp pattern
+			DIR *dp;
+			struct dirent *dirp;
+			int found = 0;
+
+			if ((dp = opendir(ARRAY_DEBUG_BASE)) != NULL) {
+				while ((dirp = readdir(dp)) != NULL) {
+					int has_sys_debug = (strstr(dirp->d_name, "sys_debug") != NULL);
+					int has_tar_gz = (strstr(dirp->d_name, ".tar.gz") != NULL);
+
+					if (has_sys_debug && has_tar_gz) {
+						int has_underscore = (strchr(filename, '_') != NULL);
+						int has_extension = (strstr(filename, ".tar.gz") != NULL);
+						// TWSD-996
+						// If full filename specified, check for exact match
+						// Check if input has timestamp (contains underscore after "sys_debug")
+						if (strlen(filename) > strlen(SYS_DEBUG) && (has_underscore || has_extension)) {
+							// User provided full filename, check exact match
+							if (strcmp(dirp->d_name, filename) == 0) {
+								found = 1;
+								break;
+							}
+						} else {
+							// User provided just "sys_debug", accept any matching file
+							found = 1;
+							break;
+						}
+					}
+				}
+				closedir(dp);
+			}
 
-		if (!file_exists(debug_file)) {
-			printf("%s doesn't exist.\n",filename);
-			return -1;
+			if (!found) {
+				printf("%s doesn't exist.\n",filename);
+				return -1;
+			}
+		} else {
+			snprintf(debug_file,sizeof(debug_file),"/var/crash/%s.tar.gz.gpg",filename);
+			if (!file_exists(debug_file)) {
+				printf("%s doesn't exist.\n",filename);
+				return -1;
+			}
 		}
 	}
 
@@ -187,7 +261,7 @@
 			scp_upload_debug_file(str, SSL_KEY_LOG, password_str, timestamp);
 		}
 	}
-	
+
 	bzero(password, strlen(password));
 	return ret;
 }
