File 1031-Fix-badarg-on-reception-of-unexpected-NETCONF-notifi.patch of Package erlang

From 4731a9fbb4911203f34a696b33ce7512b2397032 Mon Sep 17 00:00:00 2001
From: Anders Svensson <anders@erlang.org>
Date: Tue, 22 Jun 2021 20:48:46 +0200
Subject: [PATCH 1/4] Fix badarg on reception of unexpected NETCONF
 notification

A notification message received before a reply to an RFC 5277
create-subscription RPC caused a ct_netconfc connection process to fail
with badarg when the notification was banged to the atom 'undefined'.
Only forward notifications received after the create-subscription reply,
and log others in the same way as other unexpected messages (with a
similarly ungrammatical message).
---
 lib/common_test/src/ct_netconfc.erl | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/common_test/src/ct_netconfc.erl b/lib/common_test/src/ct_netconfc.erl
index 7ad6fa46e8..06264f7947 100644
--- a/lib/common_test/src/ct_netconfc.erl
+++ b/lib/common_test/src/ct_netconfc.erl
@@ -1,7 +1,7 @@
 %%----------------------------------------------------------------------
 %% %CopyrightBegin%
 %%
-%% Copyright Ericsson AB 2012-2019. All Rights Reserved.
+%% Copyright Ericsson AB 2012-2021. All Rights Reserved.
 %%
 %% Licensed under the Apache License, Version 2.0 (the "License");
 %% you may not use this file except in compliance with the License.
@@ -183,7 +183,7 @@
                                  % string() | {error, Reason}
 		buf = false,     % binary() | list() | boolean()
 		pending = [],    % [#pending]
-		event_receiver}).% pid
+		event_receiver :: pid() | undefined}).
 
 %% Run-time client options.
 -record(options, {ssh = [], % Options for the ssh application
@@ -1562,8 +1562,14 @@ decode(hello, E, #state{hello_status = Other} = State) ->
                       {hello_status, Other}]),
     State;
 
+decode(notification, E, #state{event_receiver = Pid} = State)
+  when is_pid(Pid) ->
+    Pid ! E,
+    State;
+
 decode(notification, E, State) ->
-    State#state.event_receiver ! E,
+    ConnName = (State#state.connection)#connection.name,
+    ?error(ConnName, [{got_unexpected_notification, E}]),
     State;
 
 decode(Other, E, State) ->
-- 
2.26.2

openSUSE Build Service is sponsored by