@@ -134,8 +134,10 @@ netcup_check_response() {
134134
135135 if [ " $__status " != " success" ]; then
136136 json_cleanup
137- write_log 14 " netcup DDNS: $__context failed (status='$__status ' code=$__statuscode ): $__shortmsg "
137+ write_log 3 " netcup DDNS: $__context failed (status='$__status ' code=$__statuscode ): $__shortmsg "
138+ return 1
138139 fi
140+ return 0
139141}
140142
141143# ---------------------------------------------------------------------------
@@ -154,16 +156,21 @@ json_add_object "param"
154156 json_add_string " apipassword" " $password "
155157json_close_object
156158
157- netcup_post || write_log 14 " netcup DDNS: HTTP request failed during login"
158- netcup_check_response " login"
159+ if ! netcup_post; then
160+ write_log 3 " netcup DDNS: HTTP request failed during login"
161+ return 1
162+ fi
163+ netcup_check_response " login" || return 1
159164
160165json_select " responsedata"
161166json_get_var __SESSION_ID " apisessionid"
162167json_select " .."
163168json_cleanup
164169
165- [ -z " $__SESSION_ID " ] && \
166- write_log 14 " netcup DDNS: login succeeded but no session ID was returned"
170+ if [ -z " $__SESSION_ID " ]; then
171+ write_log 3 " netcup DDNS: login succeeded but no session ID was returned"
172+ return 1
173+ fi
167174
168175write_log 6 " netcup DDNS: login successful"
169176
@@ -178,8 +185,11 @@ json_add_object "param"
178185 json_add_string " apisessionid" " $__SESSION_ID "
179186json_close_object
180187
181- netcup_post || write_log 14 " netcup DDNS: HTTP request failed during infoDnsRecords"
182- netcup_check_response " infoDnsRecords"
188+ if ! netcup_post; then
189+ write_log 3 " netcup DDNS: HTTP request failed during infoDnsRecords"
190+ return 1
191+ fi
192+ netcup_check_response " infoDnsRecords" || return 1
183193
184194# --- Step 3: Find the record matching our hostname and type ----------------
185195#
@@ -216,8 +226,10 @@ done
216226
217227json_cleanup
218228
219- [ -z " $__MATCH_ID " ] && \
220- write_log 14 " netcup DDNS: no [$__RRTYPE ] record found for hostname '$__REC_HOSTNAME ' in zone '$__ZONE '"
229+ if [ -z " $__MATCH_ID " ]; then
230+ write_log 3 " netcup DDNS: no [$__RRTYPE ] record found for hostname '$__REC_HOSTNAME ' in zone '$__ZONE '"
231+ return 1
232+ fi
221233
222234# --- Step 4: Update the matched record with the new IP ---------------------
223235
@@ -242,8 +254,12 @@ json_add_object "param"
242254 json_close_object
243255json_close_object
244256
245- netcup_post || write_log 14 " netcup DDNS: HTTP request failed during updateDnsRecords"
246- netcup_check_response " updateDnsRecords"
257+ if ! netcup_post; then
258+ write_log 3 " netcup DDNS: HTTP request failed during updateDnsRecords"
259+ return 1
260+ fi
261+
262+ netcup_check_response " updateDnsRecords" || return 1
247263json_cleanup
248264
249265write_log 6 " netcup DDNS: '$__REC_HOSTNAME .$__ZONE ' [$__RRTYPE ] updated to $__IP "
0 commit comments