@@ -1377,10 +1377,10 @@ static bool write_all(int socket, void *buf, size_t len) {
13771377 return true;
13781378}
13791379
1380- static int evaluate_clipboard_policy_dom0 (Ghandles * g ,
1380+ static bool evaluate_clipboard_policy_dom0 (Ghandles * g ,
13811381 const char * const source_vm ) {
13821382 const int sockfd = socket (AF_UNIX , SOCK_STREAM |SOCK_CLOEXEC , 0 );
1383- int status = 0 ;
1383+ bool status = false ;
13841384 if (sockfd < 0 ) {
13851385 perror ("socket" );
13861386 return false;
@@ -1458,6 +1458,7 @@ static int evaluate_clipboard_policy(Ghandles * g) {
14581458 int fd ;
14591459 ssize_t len ;
14601460 char source_vm [255 ];
1461+ bool result ;
14611462
14621463 fd = open (QUBES_CLIPBOARD_FILENAME ".source" , O_RDONLY );
14631464 if (fd < 0 )
@@ -1476,9 +1477,18 @@ static int evaluate_clipboard_policy(Ghandles * g) {
14761477 }
14771478 source_vm [len ] = 0 ;
14781479 if (g -> in_dom0 )
1479- return evaluate_clipboard_policy_dom0 (g , source_vm );
1480+ result = evaluate_clipboard_policy_dom0 (g , source_vm );
14801481 else
1481- return evaluate_clipboard_policy_domU (g , source_vm );
1482+ result = evaluate_clipboard_policy_domU (g , source_vm );
1483+ if (!result ) {
1484+ char error_msg [1024 ];
1485+ snprintf (error_msg , sizeof (error_msg ),
1486+ "Pasting from %s to %s is denied by policies" ,
1487+ source_vm ,
1488+ g -> vmname );
1489+ show_message (g , "ERROR" , error_msg , NOTIFY_EXPIRES_DEFAULT );
1490+ }
1491+ return result ;
14821492}
14831493
14841494_Static_assert (CURSOR_X11_MAX == CURSOR_X11 + XC_num_glyphs , "protocol bug" );
0 commit comments